General information
Category:
COM/DCOM and OLE Automation
>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only