I have been attempting to write a macro that will remove the hyperlinks in a document and convert the font to the same format as the rest of the document. I've accomplished the first part with this macro:
Sub KillHyperlinksinThisDocument()
Dim i As Long
For i = ActiveDocument.Hyperlinks.Count To 1 Step -1
ActiveDocument.Hyperlinks(i).Delete
Next i
End Sub
For the second part I recorded my steps using the macro recorder. What I did was do a Replace. I selected ALL, opened the Replace dialogue, searched in the FONT section, for Blue Verdana underlined font, and replaced that with FONT Black TimesNewRoman, no underline. My steps worked perfectly, and the macro recorder recorded my steps, but what it recorded didn't do anything when I tried using the macro (code is below):
Sub Hypersnew()
'
' Hypersnew Macro
' Macro recorded 1/18/2011 by John.
'
Selection.WholeStory
Selection.Fields.Unlink
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
The macro recorder doesn't appear to have captured all the Font detail that's the heart of the replacement. I'd appreciate any help I can get in getting this working.
Thanks,
John
Bookmarks