Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

write to a Word bookmark from Access Form

Status
Not open for further replies.

MooYai

Technical User
May 16, 2003
12
DE
I have a Access Form which creates and opens a Word file via a Hyperlink.Follow command.Before the user enters any data in the Word file I ant to update certain areas (bookmark in a table) of this word file.
I've been trying for months but I can't figure out how I can write data to a bookmrk in Word doument via VBA from Access.

Please help.

Thank you very much

Thomas
 
Use Words' object model. I believe that the bookmark is one of the ojects you can manipulate in VBA.


 
Thank you for your advice. I have been trying this before
but it gives me an error that variable:wdGoToBookmark is unknown.



Dim appWord As Object
Set appWord = CreateObject("Word.Application")
With appWord
.Documents.Open Filename
.Selection.Goto What:=wdGoToBookmark, Name:="Originator"
.Selection.TypeText "Thomas"
.ActiveDocument.Save
.ActiveDocument.Close
End With
Set appWord = Nothing


Any idea ?


Thomas
 
MooYai,

Are you running two threads with the same problem? If you don't have a reference to the Word Object Model you cannot use the Word Consts. wdGoToBookmark has a value of -1 if it helps.

Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top