|
楼主 |
发表于 2020-6-27 08:21
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 ggmmlol 于 2020-6-27 09:26 编辑
- Sub 常规方法清除VBA代码注释()
- [b1] = 清除VBA多行代码注释([a1])
- End Sub
- Function 清除VBA多行代码注释(ByVal S$) As String 'sfgh
- Dim aa, SS, i&, j&
- SS = Split(S, vbLf)
- For i = 0 To UBound(SS)
- If LTrim(SS(i)) Like "Rem *" Then
- SS(i) = Empty
- ElseIf SS(i) Like "*'*" Then
- aa = Split(SS(i), """")
- For j = 0 To UBound(aa) Step 2
- If aa(j) Like "*'*" Then
- n = InStr(aa(j), "'")
- aa(j) = Left(aa(j), n - 1)
- ReDim Preserve aa(0 To j)
- SS(i) = Join(aa, """")
- Exit For
- End If
- Next
- End If
- Next
- 清除VBA多行代码注释 = Join(SS, vbLf)
- End Function
复制代码 |
|