Using Word Bookmarks to read Text

C

Charles

Hi I need to collect text from a word Document and put it
in a msgbox.
I am using this code but it wont work can someone help?.

with wdApp
wdDoc.bookmarks("ProbTitle").Select
.Selection.EndKey Unit:=wdLine, Extend:=wdExtend
msgbox .Selection.Text
end with

TIA
Charles
 
T

Tom Ogilvy

If you don't have a reference set to word, the the constants wdLine and
wdExtend are viewed as uninitialized variables with a value of zero (which
probably isn't the value intended). Either create a reference to the word
object model or hard code the probably numeric value of the constants.
 

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