|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub aa()
ss = "Function Foo(v1 As Boolean, v, Optional v3 As Boolean = True, Optional ByVal cmpMethod As VbCompareMethod = vbTextCompare, Optional ByVal bStringLike As Boolean, Optional bShowWarning As Boolean = True) As Long"
k = VBA.InStr(ss, "Private")
If k <> 1 Then
Set reg = VBA.CreateObject("vbscript.regexp")
With reg
.Global = True
.ignorecase = True
.Pattern = "(byval )?([\w]+)(?= as boolean)"
jj = .Replace(ss, "byval $2")
End With
Debug.Print jj
End If
End Sub |
|