Results 1 to 9 of 9

Macro from Macro Recorder won't work

Threaded View

jomili Macro from Macro Recorder... 01-18-2011, 10:43 AM
royUK Re: Macro from Macro Recorder... 01-18-2011, 11:09 AM
jomili Re: Macro from Macro Recorder... 01-18-2011, 01:14 PM
BigDat6CC Re: Macro from Macro Recorder... 01-20-2011, 10:06 AM
jomili Re: Macro from Macro Recorder... 01-20-2011, 10:55 AM
  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,065

    Macro from Macro Recorder won't work

    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
    Last edited by jomili; 01-25-2011 at 09:37 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1