Finding/removing hidden text 
Author Message
 Finding/removing hidden text

I am trying to remove all hidden text in a document. Not
just make it hidden, but locate and delete the hidden
text. The reason for this is that there are instructions
in a template, and after the template has been used to
create a document (all automated w/ VBA), it needs to
erase the hidden text.

thanks!



Mon, 29 Nov 2004 22:45:21 GMT  
 Finding/removing hidden text
Hi Nick,

You can try the following:

ActiveDocument.ActiveWindow.View.ShowHiddenText = True
With Selection
    .HomeKey Unit:=wdStory
    With .Find
        .Text = ""
        .Font.Hidden = True
        .Replacement.Text = ""
        .Execute Replace:=wdReplaceAll
    End With
End With
ActiveDocument.ActiveWindow.View.ShowHiddenText = False

HTH

Quote:
> I am trying to remove all hidden text in a document. Not
> just make it hidden, but locate and delete the hidden
> text. The reason for this is that there are instructions
> in a template, and after the template has been used to
> create a document (all automated w/ VBA), it needs to
> erase the hidden text.

> thanks!



Mon, 29 Nov 2004 23:01:48 GMT  
 Finding/removing hidden text
Thanks! I had to change it, but here's what I got:
   bFound = True
   Selection.HomeKey Unit:=wdStory
   Do
      Selection.Find.Font.Hidden = True
      Selection.Find.Execute
      'If no selection is found Then
         bFound = False
      Else
         Selection.Delete
         Selection.MoveRight
      End If
   Loop Until Not bFound
Now my problem is that I need it to stop when it doesn't
find anymore hidden text.  Any ideas?
Thanks!
Quote:
>-----Original Message-----
>Hi Nick,

>You can try the following:

>ActiveDocument.ActiveWindow.View.ShowHiddenText = True
>With Selection
>    .HomeKey Unit:=wdStory
>    With .Find
>        .Text = ""
>        .Font.Hidden = True
>        .Replacement.Text = ""
>        .Execute Replace:=wdReplaceAll
>    End With
>End With
>ActiveDocument.ActiveWindow.View.ShowHiddenText = False

>HTH


>> I am trying to remove all hidden text in a document. Not
>> just make it hidden, but locate and delete the hidden
>> text. The reason for this is that there are instructions
>> in a template, and after the template has been used to
>> create a document (all automated w/ VBA), it needs to
>> erase the hidden text.

>> thanks!

>.



Mon, 29 Nov 2004 23:59:47 GMT  
 Finding/removing hidden text
Hi Nick,

I'm not sure why you needed to change it. The method and parameter of  the
following:

.Execute Replace:=wdReplaceAll

should remove all hidden text. I don't understand why you want it to loop
and why you want to introduce a boolen (bFound).

HTH

Quote:
> Thanks! I had to change it, but here's what I got:
>    bFound = True
>    Selection.HomeKey Unit:=wdStory
>    Do
>       Selection.Find.Font.Hidden = True
>       Selection.Find.Execute
>       'If no selection is found Then
>          bFound = False
>       Else
>          Selection.Delete
>          Selection.MoveRight
>       End If
>    Loop Until Not bFound
> Now my problem is that I need it to stop when it doesn't
> find anymore hidden text.  Any ideas?
> Thanks!
> >-----Original Message-----
> >Hi Nick,

> >You can try the following:

> >ActiveDocument.ActiveWindow.View.ShowHiddenText = True
> >With Selection
> >    .HomeKey Unit:=wdStory
> >    With .Find
> >        .Text = ""
> >        .Font.Hidden = True
> >        .Replacement.Text = ""
> >        .Execute Replace:=wdReplaceAll
> >    End With
> >End With
> >ActiveDocument.ActiveWindow.View.ShowHiddenText = False

> >HTH


> >> I am trying to remove all hidden text in a document. Not
> >> just make it hidden, but locate and delete the hidden
> >> text. The reason for this is that there are instructions
> >> in a template, and after the template has been used to
> >> create a document (all automated w/ VBA), it needs to
> >> erase the hidden text.

> >> thanks!

> >.



Tue, 30 Nov 2004 01:19:24 GMT  
 Finding/removing hidden text
That execute line didn't replace the selected text
with "". It ran that line, moved to the next one, and the
selected text was still there. I'm not sure why that is,
but I had to remove the ReplaceAll. Which is why I had to
have a loop to delete all the hidden text in the document.
Now I'm tryin to figure out how to stop when the Find
doesn't find anything.  The boolean was something I was
trying, but didn't work.
Quote:
>-----Original Message-----
>Hi Nick,

>I'm not sure why you needed to change it. The method and
parameter of  the
>following:

>..Execute Replace:=wdReplaceAll

>should remove all hidden text. I don't understand why you
want it to loop
>and why you want to introduce a boolen (bFound).

>HTH


>> Thanks! I had to change it, but here's what I got:
>>    bFound = True
>>    Selection.HomeKey Unit:=wdStory
>>    Do
>>       Selection.Find.Font.Hidden = True
>>       Selection.Find.Execute
>>       'If no selection is found Then
>>          bFound = False
>>       Else
>>          Selection.Delete
>>          Selection.MoveRight
>>       End If
>>    Loop Until Not bFound
>> Now my problem is that I need it to stop when it doesn't
>> find anymore hidden text.  Any ideas?
>> Thanks!
>> >-----Original Message-----
>> >Hi Nick,

>> >You can try the following:

>> >ActiveDocument.ActiveWindow.View.ShowHiddenText = True
>> >With Selection
>> >    .HomeKey Unit:=wdStory
>> >    With .Find
>> >        .Text = ""
>> >        .Font.Hidden = True
>> >        .Replacement.Text = ""
>> >        .Execute Replace:=wdReplaceAll
>> >    End With
>> >End With
>> >ActiveDocument.ActiveWindow.View.ShowHiddenText = False

>> >HTH


>> >> I am trying to remove all hidden text in a document.
Not
>> >> just make it hidden, but locate and delete the hidden
>> >> text. The reason for this is that there are
instructions
>> >> in a template, and after the template has been used
to
>> >> create a document (all automated w/ VBA), it needs to
>> >> erase the hidden text.

>> >> thanks!

>> >.

>.



Tue, 30 Nov 2004 01:44:03 GMT  
 Finding/removing hidden text
Hi Nick,

The routine I suggested wouldn't "move to the next one". It moves the
selection to the start of the document (therefore, whatever is selected is
no longer selected) and replaces everything that is hidden text. It leaves
the cursor alone and at the beginning of the document. Did you modify the
routine that I suggested before using it?


Quote:
> That execute line didn't replace the selected text
> with "". It ran that line, moved to the next one, and the
> selected text was still there. I'm not sure why that is,
> but I had to remove the ReplaceAll. Which is why I had to
> have a loop to delete all the hidden text in the document.
> Now I'm tryin to figure out how to stop when the Find
> doesn't find anything.  The boolean was something I was
> trying, but didn't work.
> >-----Original Message-----
> >Hi Nick,

> >I'm not sure why you needed to change it. The method and
> parameter of  the
> >following:

> >..Execute Replace:=wdReplaceAll

> >should remove all hidden text. I don't understand why you
> want it to loop
> >and why you want to introduce a boolen (bFound).

> >HTH


> >> Thanks! I had to change it, but here's what I got:
> >>    bFound = True
> >>    Selection.HomeKey Unit:=wdStory
> >>    Do
> >>       Selection.Find.Font.Hidden = True
> >>       Selection.Find.Execute
> >>       'If no selection is found Then
> >>          bFound = False
> >>       Else
> >>          Selection.Delete
> >>          Selection.MoveRight
> >>       End If
> >>    Loop Until Not bFound
> >> Now my problem is that I need it to stop when it doesn't
> >> find anymore hidden text.  Any ideas?
> >> Thanks!
> >> >-----Original Message-----
> >> >Hi Nick,

> >> >You can try the following:

> >> >ActiveDocument.ActiveWindow.View.ShowHiddenText = True
> >> >With Selection
> >> >    .HomeKey Unit:=wdStory
> >> >    With .Find
> >> >        .Text = ""
> >> >        .Font.Hidden = True
> >> >        .Replacement.Text = ""
> >> >        .Execute Replace:=wdReplaceAll
> >> >    End With
> >> >End With
> >> >ActiveDocument.ActiveWindow.View.ShowHiddenText = False

> >> >HTH


> >> >> I am trying to remove all hidden text in a document.
> Not
> >> >> just make it hidden, but locate and delete the hidden
> >> >> text. The reason for this is that there are
> instructions
> >> >> in a template, and after the template has been used
> to
> >> >> create a document (all automated w/ VBA), it needs to
> >> >> erase the hidden text.

> >> >> thanks!

> >> >.

> >.



Tue, 30 Nov 2004 02:03:10 GMT  
 Finding/removing hidden text
Hi Nick,

Perhaps the formatting needed to be cleared from a previous search?

ActiveDocument.ActiveWindow.View.ShowHiddenText = True
With Selection
    .HomeKey Unit:=wdStory
    With .Find
        .ClearFormatting
        .Text = ""
        .Font.Hidden = True
        With .Replacement
            .ClearFormatting
            .Text = ""
        End With
        .Execute Replace:=wdReplaceAll
    End With
End With
ActiveDocument.ActiveWindow.View.ShowHiddenText = False

Also, if you're determine to loop through, you can use

ActiveDocument.ActiveWindow.View.ShowHiddenText = True
With Selection
    .HomeKey Unit:=wdStory
    With .Find
        .ClearFormatting
        .Text = ""
        .Font.Hidden = True
        With .Replacement
            .ClearFormatting
            .Text = ""
        End With
        Do While .Execute
            Selection.delete
        Loop
    End With
End With
ActiveDocument.ActiveWindow.View.ShowHiddenText = False

HTH

Quote:
> That execute line didn't replace the selected text
> with "". It ran that line, moved to the next one, and the
> selected text was still there. I'm not sure why that is,
> but I had to remove the ReplaceAll. Which is why I had to
> have a loop to delete all the hidden text in the document.
> Now I'm tryin to figure out how to stop when the Find
> doesn't find anything.  The boolean was something I was
> trying, but didn't work.
> >-----Original Message-----
> >Hi Nick,

> >I'm not sure why you needed to change it. The method and
> parameter of  the
> >following:

> >..Execute Replace:=wdReplaceAll

> >should remove all hidden text. I don't understand why you
> want it to loop
> >and why you want to introduce a boolen (bFound).

> >HTH


> >> Thanks! I had to change it, but here's what I got:
> >>    bFound = True
> >>    Selection.HomeKey Unit:=wdStory
> >>    Do
> >>       Selection.Find.Font.Hidden = True
> >>       Selection.Find.Execute
> >>       'If no selection is found Then
> >>          bFound = False
> >>       Else
> >>          Selection.Delete
> >>          Selection.MoveRight
> >>       End If
> >>    Loop Until Not bFound
> >> Now my problem is that I need it to stop when it doesn't
> >> find anymore hidden text.  Any ideas?
> >> Thanks!
> >> >-----Original Message-----
> >> >Hi Nick,

> >> >You can try the following:

> >> >ActiveDocument.ActiveWindow.View.ShowHiddenText = True
> >> >With Selection
> >> >    .HomeKey Unit:=wdStory
> >> >    With .Find
> >> >        .Text = ""
> >> >        .Font.Hidden = True
> >> >        .Replacement.Text = ""
> >> >        .Execute Replace:=wdReplaceAll
> >> >    End With
> >> >End With
> >> >ActiveDocument.ActiveWindow.View.ShowHiddenText = False

> >> >HTH


> >> >> I am trying to remove all hidden text in a document.
> Not
> >> >> just make it hidden, but locate and delete the hidden
> >> >> text. The reason for this is that there are
> instructions
> >> >> in a template, and after the template has been used
> to
> >> >> create a document (all automated w/ VBA), it needs to
> >> >> erase the hidden text.

> >> >> thanks!

> >> >.

> >.



Tue, 30 Nov 2004 02:07:36 GMT  
 Finding/removing hidden text
That works! Thanks Dave! Once the normal code worked, it
doesn't have to loop anymore. Your explination was
helpful. :)
Quote:
>-----Original Message-----
>Hi Nick,

>Perhaps the formatting needed to be cleared from a
previous search?

>ActiveDocument.ActiveWindow.View.ShowHiddenText = True
>With Selection
>    .HomeKey Unit:=wdStory
>    With .Find
>        .ClearFormatting
>        .Text = ""
>        .Font.Hidden = True
>        With .Replacement
>            .ClearFormatting
>            .Text = ""
>        End With
>        .Execute Replace:=wdReplaceAll
>    End With
>End With
>ActiveDocument.ActiveWindow.View.ShowHiddenText = False

>Also, if you're determine to loop through, you can use

>ActiveDocument.ActiveWindow.View.ShowHiddenText = True
>With Selection
>    .HomeKey Unit:=wdStory
>    With .Find
>        .ClearFormatting
>        .Text = ""
>        .Font.Hidden = True
>        With .Replacement
>            .ClearFormatting
>            .Text = ""
>        End With
>        Do While .Execute
>            Selection.delete
>        Loop
>    End With
>End With
>ActiveDocument.ActiveWindow.View.ShowHiddenText = False

>HTH


>> That execute line didn't replace the selected text
>> with "". It ran that line, moved to the next one, and
the
>> selected text was still there. I'm not sure why that is,
>> but I had to remove the ReplaceAll. Which is why I had
to
>> have a loop to delete all the hidden text in the
document.
>> Now I'm tryin to figure out how to stop when the Find
>> doesn't find anything.  The boolean was something I was
>> trying, but didn't work.
>> >-----Original Message-----
>> >Hi Nick,

>> >I'm not sure why you needed to change it. The method
and
>> parameter of  the
>> >following:

>> >..Execute Replace:=wdReplaceAll

>> >should remove all hidden text. I don't understand why
you
>> want it to loop
>> >and why you want to introduce a boolen (bFound).

>> >HTH


>> >> Thanks! I had to change it, but here's what I got:
>> >>    bFound = True
>> >>    Selection.HomeKey Unit:=wdStory
>> >>    Do
>> >>       Selection.Find.Font.Hidden = True
>> >>       Selection.Find.Execute
>> >>       'If no selection is found Then
>> >>          bFound = False
>> >>       Else
>> >>          Selection.Delete
>> >>          Selection.MoveRight
>> >>       End If
>> >>    Loop Until Not bFound
>> >> Now my problem is that I need it to stop when it
doesn't
>> >> find anymore hidden text.  Any ideas?
>> >> Thanks!
>> >> >-----Original Message-----
>> >> >Hi Nick,

>> >> >You can try the following:

>> >> >ActiveDocument.ActiveWindow.View.ShowHiddenText =
True
>> >> >With Selection
>> >> >    .HomeKey Unit:=wdStory
>> >> >    With .Find
>> >> >        .Text = ""
>> >> >        .Font.Hidden = True
>> >> >        .Replacement.Text = ""
>> >> >        .Execute Replace:=wdReplaceAll
>> >> >    End With
>> >> >End With
>> >> >ActiveDocument.ActiveWindow.View.ShowHiddenText =
False

>> >> >HTH


>> >> >> I am trying to remove all hidden text in a
document.
>> Not
>> >> >> just make it hidden, but locate and delete the
hidden
>> >> >> text. The reason for this is th{ w " ,b?>\

> t  ? at there are

- Show quoted text -

Quote:
>> instructions
>> >> >> in a template, and after the template has been
used
>> to
>> >> >> create a document (all automated w/ VBA), it
needs to
>> >> >> erase the hidden text.

>> >> >> thanks!

>> >> >.

>> >.

>.



Tue, 30 Nov 2004 02:33:21 GMT  
 Finding/removing hidden text
Nope, I pasted it in straight first. Then modified it
after the first run.
Quote:
>-----Original Message-----
>Hi Nick,

>The routine I suggested wouldn't "move to the next one".
It moves the
>selection to the start of the document (therefore,

whatever is selected is
Quote:
>no longer selected) and replaces everything that is

hidden text. It leaves
Quote:
>the cursor alone and at the beginning of the document.
Did you modify the
>routine that I suggested before using it?



>> That execute line didn't replace the selected text
>> with "". It ran that line, moved to the next one, and
the
>> selected text was still there. I'm not sure why that is,
>> but I had to remove the ReplaceAll. Which is why I had
to
>> have a loop to delete all the hidden text in the
document.
>> Now I'm tryin to figure out how to stop when the Find
>> doesn't find anything.  The boolean was something I was
>> trying, but didn't work.
>> >-----Original Message-----
>> >Hi Nick,

>> >I'm not sure why you needed to change it. The method
and
>> parameter of  the
>> >following:

>> >..Execute Replace:=wdReplaceAll

>> >should remove all hidden text. I don't understand why
you
>> want it to loop
>> >and why you want to introduce a boolen (bFound).

>> >HTH


>> >> Thanks! I had to change it, but here's what I got:
>> >>    bFound = True
>> >>    Selection.HomeKey Unit:=wdStory
>> >>    Do
>> >>       Selection.Find.Font.Hidden = True
>> >>       Selection.Find.Execute
>> >>       'If no selection is found Then
>> >>          bFound = False
>> >>       Else
>> >>          Selection.Delete
>> >>          Selection.MoveRight
>> >>       End If
>> >>    Loop Until Not bFound
>> >> Now my problem is that I need it to stop when it
doesn't
>> >> find anymore hidden text.  Any ideas?
>> >> Thanks!
>> >> >-----Original Message-----
>> >> >Hi Nick,

>> >> >You can try the following:

>> >> >ActiveDocument.ActiveWindow.View.ShowHiddenText =
True
>> >> >With Selection
>> >> >    .HomeKey Unit:=wdStory
>> >> >    With .Find
>> >> >        .Text = ""
>> >> >        .Font.Hidden = True
>> >> >        .Replacement.Text = ""
>> >> >        .Execute Replace:=wdReplaceAll
>> >> >    End With
>> >> >End With
>> >> >ActiveDocument.ActiveWindow.View.ShowHiddenText =
False

>> >> >HTH


>> >> >> I am trying to remove all hidden text in a
document.
>> Not
>> >> >> just make it hidden, but locate and delete the
hidden
>> >> >> text. The reason for this is that there are
>> instructions
>> >> >> in a template, and after the template has been
used
>> to
>> >> >> create a document (all automated w/ VBA), it
needs to
>> >> >> erase the hidden text.

>> >> >> thanks!

>> >> >.

>> >.

>.



Tue, 30 Nov 2004 02:30:11 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Removing Hidden Text

2. global find/replace with highlights or hidden text

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

4. Find various text and copy the found text into different document

5. Removing text from a text file

6. Remove Hidden Characters

7. Hidden text and text insert

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

9. Hidden Text in Rich Text Box

10. VB crashes after I remove strange hidden controls

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

12. VB crashes after I remove strange hidden controls

 

 
Powered by phpBB® Forum Software