Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Moving to a Bookmark in word document thru VFP
Message
From
24/05/2002 13:31:56
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00661042
Message ID:
00661177
Views:
72
>Can somebody help me to move the cursor in a word document to a bookmark. I tried "oWord.Selection.GoTo([BookMark1])", but it doesn't work.

As Cetin pointed out, you don't need the Goto method. However, there's a good chance you don't need the Select method either. For example, if your goal is to replace the bookmark with some text, you can do it like this:

oWord.Bookmarks(YourBookmark).Range.Text = "Your Text Here"

If you'd like to work with the contents of the bookmark, you can make a range object from it and then proceed:

oRange = oWord.Bookmarks(YourBookmark).Range()
WITH oRange
* do some stuff
ENDWITH

In general, it's a good idea to avoid the Selection object and the Select method. Macros you record use them because they're mimicking user interaction, but your automation code doesn't need to do that. It can work directly with the document content without selecting it.

Tamar
Previous
Reply
Map
View

Click here to load this message in the networking platform