Select a page with VB

B

bahumble

How do I set up a macro to search for a word on one page only in a document
and if that word is not found, delete that page and search the next page?
 
J

Jean-Guy Marcil

bahumble was telling us:
bahumble nous racontait que :
How do I set up a macro to search for a word on one page only in a
document and if that word is not found, delete that page and search
the next page?

Use

ActiveDocument.Bookmarks("\Page").Range

or

ActiveDocument.Bookmarks("\Page").Range.Select

to create either a Range or a Selection object (whichever you are more
comfortable with).

Search that object, if the word is found, delete the Selection or the Range
and move on to the next page.

Also, include dome code to test if there is a next page to go to...

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
[email protected]
Word MVP site: http://www.word.mvps.org
 
Top