Wrangler36
Technical User
I'm having a little trouble formatting some text in a Word document. I'm using the "Find" operation to find the first, and only, occurrence of some text.
The steps I need to carry out are:
1) Find the "Registered" trademark symbol
2) Set it as Superscript
3) Find the web address "4) Underline the web address and change the color to blue
The Registered trademark appears first in the document before the web address.
My problem: Word is finding the "Registered" trademark and performing the superscript, but it is also changing the color of the "Registered" trademark to blue and underlining it. For some reason it is performing the 1st part of the code on the "Registered" trademark and also performing the 2nd part of the code on the "Registered" trademark, when it should be performing the 2nd part of the code on the web address.
What am I missing? Here is the code I'm using which I obtained by recording a macro:
'Format the Registered trademark as superscript
Selection.Find.ClearFormatting
With Selection.Find
.Text = "®"
.Replacement.Text = ""
.Forward = True
End With
Selection.Find.Execute
With Selection.Font
.Superscript = True
End With
'Format web address as underline and change color to blue
Selection.Find.ClearFormatting
With Selection.Find
.Text = " .Replacement.Text = ""
.Forward = True
End With
Selection.Find.Execute
If Selection.Font.Underline = wdUnderlineNone Then
Selection.Font.Underline = wdUnderlineSingle
Else
Selection.Font.Underline = wdUnderlineNone
End If
Selection.Font.Color = wdColorBlue
The steps I need to carry out are:
1) Find the "Registered" trademark symbol
2) Set it as Superscript
3) Find the web address "4) Underline the web address and change the color to blue
The Registered trademark appears first in the document before the web address.
My problem: Word is finding the "Registered" trademark and performing the superscript, but it is also changing the color of the "Registered" trademark to blue and underlining it. For some reason it is performing the 1st part of the code on the "Registered" trademark and also performing the 2nd part of the code on the "Registered" trademark, when it should be performing the 2nd part of the code on the web address.
What am I missing? Here is the code I'm using which I obtained by recording a macro:
'Format the Registered trademark as superscript
Selection.Find.ClearFormatting
With Selection.Find
.Text = "®"
.Replacement.Text = ""
.Forward = True
End With
Selection.Find.Execute
With Selection.Font
.Superscript = True
End With
'Format web address as underline and change color to blue
Selection.Find.ClearFormatting
With Selection.Find
.Text = " .Replacement.Text = ""
.Forward = True
End With
Selection.Find.Execute
If Selection.Font.Underline = wdUnderlineNone Then
Selection.Font.Underline = wdUnderlineSingle
Else
Selection.Font.Underline = wdUnderlineNone
End If
Selection.Font.Color = wdColorBlue