AoNXGLI5.rar
(20.58 KB, 下载次数: 1706)
在守柔版主的帮助下,将中文Word2000高级教程之VBA篇整理了一下,希望对大家有帮助
下面附上解决类似问题的代码
【作者:守柔】
Sub Par()
Dim i As Paragraph, Myrange As Range
Application.ScreenUpdating = False
On Error Resume Next
For Each i In ActiveDocument.Paragraphs
If i.Range Like "*.?.*" = True Then i.Range.Font.Bold = True
If i.Range Like "*.?.*" = True Or i.Range Like "*=*" = True Or i.Range Like "*Sub*" = True _
Or i.Range Like "*End*" = True Or i.Range Like "*""*""*" = True Or i.Range Like "*Next*" = True _
Or i.Range Like "*Else*" = True Or i.Range Like "*MsgBox*" = True Or i.Range Like "*Select*" = True _
Or i.Range Like "*For*" Then
Else
Set Myrange = ActiveDocument.Range(i.Range.End - 2, i.Range.End - 1)
If Myrange <> "。" And Myrange.Font.Bold = False Then'这里是句号
'MsgBox Range(i.Range.End - 2, i.Range.End - 1)
Myrange.Select
Selection.EndKey Unit:=wdLine
Selection.Delete
End If
End If
Next
Application.ScreenUpdating = True
End Sub |