Quote:
Originally Posted by gcp
Thanks Paul. I couldn't make that work as "Replace = nothing
where the Find format is specified as superscript" is beyond my abilities.
In any event, my aim is to learn to write VBA macros.
|
I tested it and it worked for me. Are your parentheses superscripted?
As a macro, the Find/Replace becomes:
Code:
Sub DemoA()
Application.ScreenUpdating = False
With ActiveDocument.Range.Find
.ClearFormatting
.Replacement.ClearFormatting
.Font.Superscript = True
.Text = "\(*\)"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With
Application.ScreenUpdating = True
End Sub
or even:
Code:
Sub DemoB()
Application.ScreenUpdating = False
With ActiveDocument.Range.Find
.ClearFormatting
.Replacement.ClearFormatting
.Font.Superscript = True
.Execute FindText:="\(*\)", ReplaceWith:="", MatchWildcards:=True, Format:=False, Forward:=True, Wrap:=wdFindContinue, Replace:=wdReplaceAll
End With
Application.ScreenUpdating = True
End Sub
Avoid generative AI VBA code - it's frequently bug-ridden. Even Word's macro recorder would have done better in this instance.