Find returns deleted text in word 2003

K

Kristian

Hi

In word 2000 i search for some text that can be hidden. I use
Set r = ActiveDocument.Range.Duplicate
r.TextRetrievalMode.IncludeHiddenText = True
With r.Find
.Text = "some text"
.Forward = True
End With
r.Find.Execute
If r.Find.Found Then
MsgBox "Found it"
end if

If i use this code it works as excpected. And if i delete "some text" i dont
get any MsgBox. In Word 2003 after i delete the text i still get the message
box. It seems that word 2003 treats deleted text as hidden text.

Is there any good workaround to exlude the deleted text?
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?S3Jpc3RpYW4=?=,

My guess would be that the document contains tracked (reviewing) changes, so
the deleted text is still present in the document (irrespective of whether
hidden formatting is or is not applied). Check whether the document you're
testing has any reviewing changes: display the Reviewing toolbar and make sure
you're viewing Final or Original WITH MARKUP.
In word 2000 i search for some text that can be hidden. I use
Set r = ActiveDocument.Range.Duplicate
r.TextRetrievalMode.IncludeHiddenText = True
With r.Find
.Text = "some text"
.Forward = True
End With
r.Find.Execute
If r.Find.Found Then
MsgBox "Found it"
end if

If i use this code it works as excpected. And if i delete "some text" i dont
get any MsgBox. In Word 2003 after i delete the text i still get the message
box. It seems that word 2003 treats deleted text as hidden text.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top