Removing Hidden Text 
Author Message
 Removing Hidden Text

I've written a utility which simply opens word docs and saves them in HTML
format using automation.

I've come accross some docs that have "Hidden Text" which then shows up in
the resulting HTML doc format.

Is there a quick way to remove all hidden text from a doc or a
setting/option that will cause the hidden text NOT to be saved?

--

v/r
Brendan
http://www.*-*-*.com/



Mon, 31 May 2004 02:02:08 GMT  
 Removing Hidden Text
Hi, Brendan,

Call this subroutine from your utility before you save as HTML to delete all
the text that has the Hidden property:

Sub ClearHiddenText()
    Dim bShowHidden As Boolean

    bShowHidden = ActiveWindow.View.ShowHiddenText
    ActiveWindow.View.ShowHiddenText = True
    With Selection.Find
        .ClearFormatting
        .Font.Hidden = True
        .Replacement.ClearFormatting
        .Text = ""
        .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
    ActiveWindow.View.ShowHiddenText = bShowHidden
End Sub

It doesn't matter whether or not the document has any Hidden text -- if
there isn't any, the macro will have no effect.

Notice that the Hidden text must be visible for the .Find to work.

When you close the original document, do it this way to avoid saving the
changes:

   ActiveDocument.Close SaveChanges:=False
--
Regards,
Jay Freedman
Microsoft Word MVP        Word MVP FAQ site: http://www.mvps.org/word


Quote:
> I've written a utility which simply opens word docs and saves them in HTML
> format using automation.

> I've come accross some docs that have "Hidden Text" which then shows up in
> the resulting HTML doc format.

> Is there a quick way to remove all hidden text from a doc or a
> setting/option that will cause the hidden text NOT to be saved?

> --

> v/r
> Brendan
> http://www.photoact.net



Mon, 31 May 2004 02:53:28 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Finding/removing hidden text

2. Rich Text Box: Can I remove text and keep multicolored text

3. Removing text from a text file

4. Remove Hidden Characters

5. Hidden text and text insert

6. Remove Column in unbound FlexGrid ?? (or hide it)

7. Hidden Text in Rich Text Box

8. VB crashes after I remove strange hidden controls

9. Master/detail form, remove or hide column?

10. VB crashes after I remove strange hidden controls

11. Getting text from hidden text producing error

12. Hide or Remove MS Agent Characters from Tray?

 

 
Powered by phpBB® Forum Software