R
Rahul Aggarwal
I'm using Visual Studio 6 to write a Visual Basic app that opens an
existing word document template and makes a number of changes and
additions to it.
I'm having a difficult time in trying to, among other things, move the
cursor (the insertion point) to the end of the file or to a bookmark.
Here's the code:
Set CurrentDoc = GetObject("C:\data\SSATemplate.doc")
CurrentDoc.ActiveWindow.Visible = True
' Move cursor to a bookmark
CurrentDoc.ActiveWindow.Selection.Goto What:=wdGToBookmark,
Name:="PathDataStart"
/ Move cursor to the end of the document
CurrentDoc.ActiveWindow.Selection.Endkey Unit:=wdStory, Extend:=wdMove
The document opens with no problems but when I try to move the cursor
to the bookmark (the only bookmark in the entire document), I get the
error message:
Error 5102: You entered multiple destinations for a page, line,
footnote, endnote, or comment.
When I try to move the cursor to the end of the document, I get the
error message:
Error 4102: Bad parameter
I've tried everything I can think of to fix the problem, to no avail.
Any help would be appreciated.
Thanks in advance.
existing word document template and makes a number of changes and
additions to it.
I'm having a difficult time in trying to, among other things, move the
cursor (the insertion point) to the end of the file or to a bookmark.
Here's the code:
Set CurrentDoc = GetObject("C:\data\SSATemplate.doc")
CurrentDoc.ActiveWindow.Visible = True
' Move cursor to a bookmark
CurrentDoc.ActiveWindow.Selection.Goto What:=wdGToBookmark,
Name:="PathDataStart"
/ Move cursor to the end of the document
CurrentDoc.ActiveWindow.Selection.Endkey Unit:=wdStory, Extend:=wdMove
The document opens with no problems but when I try to move the cursor
to the bookmark (the only bookmark in the entire document), I get the
error message:
Error 5102: You entered multiple destinations for a page, line,
footnote, endnote, or comment.
When I try to move the cursor to the end of the document, I get the
error message:
Error 4102: Bad parameter
I've tried everything I can think of to fix the problem, to no avail.
Any help would be appreciated.
Thanks in advance.