Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Word Auto: trouble with .GoTo a Bookmark in Word
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01310785
Message ID:
01310951
Views:
12
>Hi Yuri,
>
>The bookmarkID worked but in the end, the GoTo() method only moves the *range* to that point and does not visually move the insertion point (although that might be workable, it's not what my wrapper function is trying to do). It seems that I have to instead use the .Select() method of the bookmark to move to and select the bookmark i.e.
>
>
>
>loBookmark = loDocument.Bookmarks.ItemID(tcBookmarkName)
>loBookmark.Select()
>
>
>
>This has the "down side" of actually selecting the bookmark which may prove to be troublesome but I will have to work with it for now.
>
>On another note, one of your lines of code needs fixing up a bit (and it is also wrong in the book I am using, it seems, so it seems to be a common mistake). This:
>
>
>oWord.Selection.GoTo(wdGoToBookmark,,,tcBookmarkName)
>
>* should be:
>
>oWord.Application.Selection.GoTo(wdGoToBookmark,,tcBookmarkName)
>
>
>
>(just in case some one else reads this thread. At least, I could not get it to work any other way).
>
>Albert


Albert,

Do you need INsertAfter, or move the cursor, or both?
You do not need to move the cursor, or select the range to modify the document content:
with oword.activedocument.BOOKMARKs("bookmark_name").Range
   .InsertAFter("Hello")
ENDWITH
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform