Hi Greg
a) Underlined text > Bolded text and a specific color;
b) Bold/Underlined text > Bold and specific color.
Logically, you have to do them in the reverse order (b, then a). The
following code should do what you need. To change the colours, delete,
eg, " = wdColorGreen". Then type an equals sign and Word will pop up
all the valid colour choices from which you can choose. I've included
comments to show what the code is doing.
If you're not sure what to do with the macro, see
http://www.gmayor.dsl.pipex.com/installing_macro.htm and
http://www.mvps.org/word/FAQs/MacrosVBA/CreateAMacro.htm
Sub ChangeGregsFormatting()
'Shauna Kelly, 14 December 2003
'for microsoft.public.word.newusers
'
'Changes text that is bold + underline
'to bold + blue + no underline.
'Changes text that is underlined
'to bold + green + no underline.
'STEP 1: BOLD + UNDERLINED TO BOLD + BLUE
'Clean out left-over settings
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
'Set what to find
.Text = ""
With .Font
.Bold = True
.Underline = True
End With
'Set how to find it
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
'Set the replacement
With .Replacement
.Text = ""
With .Font
.Bold = True
.Color = wdColorBlue
.Underline = wdUnderlineNone
End With
End With
'Do the search and replace
.Execute Replace:=wdReplaceAll
End With
'STEP 2: UNDERLINED TO BOLD + GREEN
'Clean out left-over settings
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
'Set what to find
.Text = ""
.Font.Underline = True
'Set how to find it
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
'Set the replacement
With .Replacement
.Text = ""
With .Font
.Bold = True
.Color = wdColorGreen
.Underline = wdUnderlineNone
End With
End With
'Do the search and replace
.Execute Replace:=wdReplaceAll
End With
End Sub
Hope this helps.
Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
Melbourne, Australia