A
Al
I am updating an MS Word document from MS Access, below is my code. The
following statement works when I have a reference to the VBA Microsoft Word
Object Library 10.0 in Access set, but I receive Error no: 5101 “This
bookmark does not existâ€.
when I uncheck the Microsoft Word Object Library 10.0 reference in Access
VBA: (reference ** in code)
appWord.Selection.Goto What:=wdGoToBookmark, Name:="IIIA1"
I wish to use late-binding in this application so it will work more
universally. What is wrong with this statement?
Also, will the next 2 statements work without modification?
Is there a source for MS Word error no. descriptions? Also, where can I
read more about Word objects—what they are and how to use them?
Thanks for your assistance!!
Alan
ACCESS CODE FOLLOWS:
‘DECLARE VARS
Dim appWord As Object
Dim Docs As Object
‘OPEN MW WORD AND DOCUMENT
strSched = "C:\Templates\Document.dot
Set appWord = GetObject(, "Word.Application")
Set Docs = appWord.Documents
Docs.Add strSched
‘GOTO BOOKMARK AND HIDE TEXT
** appWord.Selection.Goto What:=wdGoToBookmark, Name:="IIIA1"
appWord.Selection.MoveRight Unit:=wdCharacter, Count:=198,
Extend:=wdExtend
appWord.Selection.Font.Hidden = True
‘QUITE MS WORD AND RESET DIM VARS
appWord.Quit
Set appWord = Nothing
Set Docs = Nothing
following statement works when I have a reference to the VBA Microsoft Word
Object Library 10.0 in Access set, but I receive Error no: 5101 “This
bookmark does not existâ€.
when I uncheck the Microsoft Word Object Library 10.0 reference in Access
VBA: (reference ** in code)
appWord.Selection.Goto What:=wdGoToBookmark, Name:="IIIA1"
I wish to use late-binding in this application so it will work more
universally. What is wrong with this statement?
Also, will the next 2 statements work without modification?
Is there a source for MS Word error no. descriptions? Also, where can I
read more about Word objects—what they are and how to use them?
Thanks for your assistance!!
Alan
ACCESS CODE FOLLOWS:
‘DECLARE VARS
Dim appWord As Object
Dim Docs As Object
‘OPEN MW WORD AND DOCUMENT
strSched = "C:\Templates\Document.dot
Set appWord = GetObject(, "Word.Application")
Set Docs = appWord.Documents
Docs.Add strSched
‘GOTO BOOKMARK AND HIDE TEXT
** appWord.Selection.Goto What:=wdGoToBookmark, Name:="IIIA1"
appWord.Selection.MoveRight Unit:=wdCharacter, Count:=198,
Extend:=wdExtend
appWord.Selection.Font.Hidden = True
‘QUITE MS WORD AND RESET DIM VARS
appWord.Quit
Set appWord = Nothing
Set Docs = Nothing