Excluding objects in a range

J

jfl4066

Hi,
I have a Word 2003 document containing a couple of tables and some text
outside the tables. How can I set a search range for the text outside the
tables? Thanks for the help.
 
D

Doug Robbins - Word MVP

Use something like:

Dim Findstr As String
Findstr = InputBox("Insert the text that you want to find.")
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:=Findstr, Forward:=True, _
MatchWildcards:=False, Wrap:=wdFindStop, MatchCase:=False) = True
If Selection.Information(wdWithInTable) = False Then
'do something
End If
Selection.Collapse wdCollapseEnd
Loop
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
J

jfl4066

Thanks Doug. I was hoping to not have to iterate thru the entire story by
setting a range excluding the tables. But I guess there's no other way.
 

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