![]() |
#1
|
|||
|
|||
![]()
I wrote this macro to find all the hidden text in a document, and replace it with nothing (delete it). The problem is, it is doing the EXACT OPPOSITE. It is finding all the NOT hidden text and deleting it. After I run the macro, if I click on "Edit-Replace" it says "Not Hidden" in the find window. It should just say "Hidden." What am I doing wrong?
Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "" .Font.Hidden = True .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll |
#2
|
|||
|
|||
![]()
Try this before you run the Selection.Find:
ActiveWindow.View.ShowHiddenText = True BTW, I tried your code as-is and it merely failed; it didn't remove un-hidden text. |
#3
|
||||
|
||||
![]()
This works for me:
Code:
Sub Demo() With ActiveDocument.Content.Find .ClearFormatting .Replacement.ClearFormatting .Text = "" .Replacement.Text = "" .Format = True .Font.Hidden = True .Forward = True .Wrap = wdFindContinue .Execute Replace:=wdReplaceAll End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
TAFE | Word | 4 | 11-04-2009 02:50 AM |
Macro library | pankajkankaria | Excel | 1 | 04-12-2009 09:06 AM |
macro on checkbox | macrohelp | Word VBA | 0 | 03-06-2009 03:33 PM |
Unable to run the specified macro | jtrirogoff | Word | 0 | 02-05-2009 04:38 PM |
Macro Issue | Basanth | Excel | 1 | 12-05-2008 08:07 PM |