|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub FindActiveDocument()
- '全文查找/光标不动/不激活对象/速度极快!
- With ActiveDocument.Content.Find
- .ClearFormatting
- .Text = "[0-9.,, ^s^t]{1,}元"
- .Forward = True
- .MatchWildcards = True
- Do While .Execute
- With .Parent
- .Font.ColorIndex = wdRed
- ' .Start = .End
- End With
- Loop
- End With
- End Sub
- Sub FindRange()
- '区域查找/未选则全选/光标不动/不激活对象/速度极快!
- Dim r As Range
- Set r = IIf(Selection.Type = wdSelectionIP, ActiveDocument.Content, Selection.Range)
- With r.Find
- .ClearFormatting
- .Text = "[0-9.,, ^s^t]{1,}元"
- .Forward = True
- .MatchWildcards = True
- Do While .Execute
- With .Parent
- If Not Selection.Type = wdSelectionIP Then
- If .End > Selection.End Then Exit Do
- End If
- .Font.ColorIndex = wdRed
- ' .Start = .End
- End With
- Loop
- End With
- End Sub
- Sub FindSelection()
- '从插入点向后查找/光标移动/激活对象/速度较慢/尽量少用!
- With Selection
- ' .HomeKey 6
- With .Find
- .ClearFormatting
- .Text = "[0-9.,, ^s^t]{1,}元"
- .Replacement.Text = ""
- .Forward = True
- .MatchWildcards = True
- Do While .Execute
- With .Parent
- .Font.Color = wdColorRed
- ' .Start = .End
- End With
- Loop
- End With
- End With
- End Sub
- Sub FindBold()
- '取消加粗
- With ActiveDocument.Content.Find
- .ClearFormatting
- .Font.Bold = True
- With .Replacement
- .ClearFormatting
- .Font.Bold = False
- End With
- .Execute Findtext:="", ReplaceWith:="", Format:=True, Replace:=wdReplaceAll
- End With
- End Sub
- Sub FindReplace()
- ActiveDocument.Content.Find.Execute Findtext:="a", MatchWildcards:=True, ReplaceWith:="b", Replace:=wdReplaceAll
- ActiveDocument.Content.Find.Execute "[一-﨩]@", , , 1, , , , , , "", 2
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|