Simple problem - ?

P

Pete

Hello - I bet this is simple... but any help would be
great! I'm a fairly experienced programmer, but just
starting with a VB app driving Word. I have a document
that I know contains a particular word, and I wish to
obtain the text of the page the word is found within. In
other words, I guess I need to search for this word, then
somehow define a range for the entire surrounding page,
then return that text. The page is defined by page breaks
(or, if it's easier, I can search for another known word
that would indicate the end of the required section).
I've played around with ranges and selections but I must
be missing something...
Thanks! Pete
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

Hi Pete,

Grab the .Range of the built in Bookmark \page by either selecting the word
and using Selection.Bookmarks("\page").Range or setting a Range (myrange) to
the range of the Word and then using myrange.Bookmarks("\page").Range

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 

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