|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
* 楼主,请试用下面的两个宏:(第1个宏:全部替换;第2个宏:请手动将光标置于不想替换的公式中,再执行该宏。抱歉!不知怎么区分公式与正常想替换的部分。你怎么区分?按 Alt + F8 打开宏列表。)
- Sub a0907_FindText()
- With ActiveDocument.Content.Find
- .ClearFormatting
- .Text = "\([a-z]\)"
- .Forward = True
- .MatchWildcards = True
- Do While .Execute
- With .Parent
- .Characters.First.Text = "("
- .Characters.Last.Text = ")"
- .MoveEnd
- .Font.Color = wdColorRed
- .Start = .End
- End With
- Loop
- End With
- End Sub
- Sub a0907_CancelChanges()
- '请将光标放在不改的公式中执行此宏!
- With Selection
- Do
- .MoveStart 1, -1
- Loop Until .Text Like "[一-﨩]*"
- Do
- .MoveEnd
- Loop Until .Text Like "*[一-﨩]"
- With .Range.Find
- .Execute "(", , , 0, , , , , , "(", 2
- .Execute ")", , , 0, , , , , , ")", 2
- End With
- End With
- End Sub
复制代码 |
|