Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Jan 2004
    Location
    Kingwood, Texas, USA
    Posts
    112
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macro code to highliht shade hidden text (Word 2003)

    I have a document that was saved out of WordPerfect as a RTF file and then opeed in Word. It has a lot of hidden text in it. I would like to shade the hidden text only so when I print it on my laser the hidden text stands out from the normal text.

    If possible, how would one code to search for and select the hidden text and shade it?

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Macro code to highliht shade hidden text (Word 2003)

    You can highlight one hidden word using the Highlight tool on the toolbar (to set the highlight colour). Then

    Edit > Replace
    Click More
    Find What > Special > Any Character
    Format > Font > Hidden
    Replace With > Special > Find What Text
    Format > Highlight
    Replace All

    StuartR

  3. #3
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Macro code to highliht shade hidden text (Word 2003)

    I just realised that you asked how to code this, so here is some code for you

    StuartR
    <font face="Georgia">
    Sub HighlightHidden()
    Dim rngWholeDoc As Range

    Set rngWholeDoc = ActiveDocument.Content

    Options.DefaultHighlightColorIndex = wdYellow
    rngWholeDoc.Find.ClearFormatting
    rngWholeDoc.Find.Replacement.ClearFormatting
    rngWholeDoc.Find.Replacement.Highlight = True
    With rngWholeDoc.Find
    .Text = "^?"
    .Replacement.Text = "^&"
    .Font.Hidden = True
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .MatchWildcards = False
    End With
    rngWholeDoc.Find.Execute Replace:=wdReplaceAll
    End Sub
    </font face=georgia>

  4. #4
    2 Star Lounger
    Join Date
    Jan 2004
    Location
    Kingwood, Texas, USA
    Posts
    112
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro code to highliht shade hidden text (Word 2003)

    I came over here to thank you for the previous message and found this 'easter egg' code. I've never used the special stuff for replace - neat. Worked like a charm. Thanks.

    I was about to try to create a macro using the steps to at least get me started on the code, but wanted to respond to your first message before it slipped from me and you've already gone the next step. I wll give this a try right now. Thanks again.

Posting Permissions

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