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
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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