|
*** 139:请处理前备份文件,满意后再存盘!(复制代码到VBE中,关闭VBE,按 Alt+F8 再找 c打头的宏执行):
- Sub c1全文黑色()
- ActiveDocument.Content.Font.Color = wdColorBlack
- End Sub
- Sub c2手动换行符全部替换为段落标记()
- ActiveDocument.Content.Find.Execute FindText:="^l", ReplaceWith:="^p", Replace:=wdReplaceAll '手动换行符全部替换为段落标记
- ActiveDocument.Content.Find.Execute FindText:="^13", ReplaceWith:="^p", Replace:=wdReplaceAll '真假回车符全部替换为段落标记
- End Sub
- Sub c3单引号前空格替换为两个半角空格()
- ActiveDocument.Content.Find.Execute FindText:="[!a-z0-9]@(')", ReplaceWith:=" \1", Replace:=wdReplaceAll, MatchWildcards:=True
- ActiveDocument.Content.Find.Execute FindText:="([a-z0-9])(')", ReplaceWith:="\1 \2", Replace:=wdReplaceAll, MatchWildcards:=True
- MsgBox "处理完毕!!!"
- End Sub
- Sub c5中文注释结尾加标点()
- Dim i As Paragraph
- For Each i In ActiveDocument.Paragraphs
- If i.Range Like "*'*[!。:;,、!?”…—.:;,!?]" & vbCr Then
- i.Range.Characters.Last.Previous.Text = "。"
- End If
- Next
- End Sub
- Sub c6多个单引号替换为一个()
- Dim i As Paragraph, j As Long
- For Each i In ActiveDocument.Paragraphs
- If i.Range Like "*'*'*" Then
- i.Range.Characters(1).Select
- Do While Selection.Characters.Last Like "[ ']"
- Selection.MoveEnd unit:=wdCharacter, Count:=1
- Loop
- Selection.MoveEnd unit:=wdCharacter, Count:=-1
- Selection = "'"
- Selection.ParagraphFormat.CharacterUnitFirstLineIndent = 17.5
- End If
- Next
- End Sub
- Sub c8注释蓝色()
- Dim i As Paragraph
- For Each i In ActiveDocument.Paragraphs
- If i.Range Like "*'*" Then
- i.Range.Characters.Last.Previous.Select
- Selection.MoveEndUntil cset:="'", Count:=wdBackward
- Selection.MoveRight unit:=wdCharacter, Count:=1, Extend:=wdExtend
- Selection.MoveEndUntil cset:=vbCr, Count:=wdForward
- If Len(Selection) <> Len(i.Range) - 2 Then Selection.Font.Color = wdColorBlue
- End If
- Next
- End Sub
- Sub c9注释绿色_结尾段落标记未保持黑色()
- Dim i As Paragraph
- For Each i In ActiveDocument.Paragraphs
- If i.Range Like "'*" Then
- i.Range.Select
- Selection.MoveEnd unit:=wdCharacter, Count:=-1
- Selection.Font.Color = wdColorGreen
- End If
- Next
- End Sub
- Sub c11单引号全部替换为红色()
- With ActiveDocument.Content.Find
- .ClearFormatting
- With .Replacement
- .ClearFormatting
- .Font.Color = wdColorRed
- End With
- .Execute FindText:="'", ReplaceWith:="", Format:=True, Replace:=wdReplaceAll
- End With
- End Sub
复制代码 |
|