add a reference to the "Microsoft Word 8.0 Object Library"
and there you go:
Dim objWord As Word.Application
Dim objDoc As Word.Document
Dim objRange As Word.Range
Set objWord = New Word.Application
'Set objWord = GetObject(, "Word.Application" ' to use an existing word session
Set objDoc = objWord.Documents.Add("""YourWordTemplate.dot""" ' open a new document using a template
Set objRange = objDoc.Goto(What:=wdGoToBookmark, Name:="TheNameOfTheBookMark" ' go to a bookmark
If objRange Is Nothing Then
' bookmark not found
Else
objRange.Text = "This used to be a bookmark"
End If
objWord.PrintOut
objWord.ActiveDocument.Close False ' this closes the document WITHOUT saving
objWord.Quit
Set objWord = Nothing ' clean up all garbage
Set objDoc = Nothing
Set objRange = Nothing
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.