Article ID: 154568
Article Last Modified on 1/19/2007
160295 ACC: How to Use Automation to Find Bookmark in Word 97 Document
Function FindBMark()
Dim WordObj as Object
Set WordObj = CreateObject("Word.Basic")
WordObj.FileOpen "C:\My Documents\Wordtest.doc"
' Go to the bookmark named "City."
WordObj.EditBookmark "City", 0, 0, 0, 1
WordObj.Insert "Los Angeles"
End Function
? FindBMark()
Command button:
Caption: Find Bookmark
OnClick: =FindBookMark()
Function FindBookMark()
Dim WordObj as Object
Me![OLEObj].Verb = -2 ' Tells MS Access to open the application.
Me![OLEObj].Action = 7 ' Activates the application.
Set WordObj = Me![OLEObj].Object.Application.WordBasic
' Goes to the pre-defined bookmark named "City" and inserts "Los
' Angeles."
WordObj.EditGoto "city"
WordObj.Insert "Los Angeles"
WordObj.FileClose
End Function
Keywords: kbhowto kbinterop kbprogramming KB154568