I would like to write a macro warning me if when I open or save a
document, this document contains hidden text. How do I detect hidden
text in a macro?

Thanks
--
John Doue

Re: Detecting hidden text by Jay

Jay
Fri May 27 09:17:07 CDT 2005

John Doue wrote:
> I would like to write a macro warning me if when I open or save a
> document, this document contains hidden text. How do I detect hidden
> text in a macro?
>
> Thanks

Put this in Normal.dot or another global template (see
http://www.gmayor.com/installing_macro.htm):

Sub AutoOpen()
Dim oRg As Range
Set oRg = ActiveDocument.Range
ActiveWindow.View.ShowHiddenText = True
With oRg.Find
.Format = True
.Forward = True
.Font.Hidden = True
If .Execute Then
oRg.Select
With ActiveWindow.View
.ShowHiddenText = False
.ShowAll = True
End With
MsgBox "Hidden text!"
Else
ActiveWindow.View.ShowHiddenText = False
End If
End With
End Sub

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org



Re: Detecting hidden text by John

John
Fri May 27 16:01:37 CDT 2005

Jay Freedman wrote:
> John Doue wrote:
>
>>I would like to write a macro warning me if when I open or save a
>>document, this document contains hidden text. How do I detect hidden
>>text in a macro?
>>
>>Thanks
>
>
> Put this in Normal.dot or another global template (see
> http://www.gmayor.com/installing_macro.htm):
>
> Sub AutoOpen()
> Dim oRg As Range
> Set oRg = ActiveDocument.Range
> ActiveWindow.View.ShowHiddenText = True
> With oRg.Find
> .Format = True
> .Forward = True
> .Font.Hidden = True
> If .Execute Then
> oRg.Select
> With ActiveWindow.View
> .ShowHiddenText = False
> .ShowAll = True
> End With
> MsgBox "Hidden text!"
> Else
> ActiveWindow.View.ShowHiddenText = False
> End If
> End With
> End Sub
>
Thanks a lot, I'll try it tomorrow!

--
John Doue

Re: Detecting hidden text by John

John
Sat May 28 09:22:25 CDT 2005

Jay Freedman wrote:
> John Doue wrote:
>
>>I would like to write a macro warning me if when I open or save a
>>document, this document contains hidden text. How do I detect hidden
>>text in a macro?
>>
>>Thanks
>
>
> Put this in Normal.dot or another global template (see
> http://www.gmayor.com/installing_macro.htm):
>
> Sub AutoOpen()
> Dim oRg As Range
> Set oRg = ActiveDocument.Range
> ActiveWindow.View.ShowHiddenText = True
> With oRg.Find
> .Format = True
> .Forward = True
> .Font.Hidden = True
> If .Execute Then
> oRg.Select
> With ActiveWindow.View
> .ShowHiddenText = False
> .ShowAll = True
> End With
> MsgBox "Hidden text!"
> Else
> ActiveWindow.View.ShowHiddenText = False
> End If
> End With
> End Sub
>
Jay,

I just changed ShowhiddentText to True and ShowAll to false, and now, it
works. Thanks again.

--
John Doue