PDA

Click to See Complete Forum and Search --> : word bookmarks


oriole72
May 15th, 2000, 06:26 AM
Okay, Im using Microsoft Access but the coding i need to use is all visual basic stuff. I've been able to do what im about to explain but somehow the code got deleted. I have a form which has fields for a contact. eg, first name, last name, address, city, etc. I have a button that when its clicked, microsoft word will open a letter on the a:\ which has several BOOKMARKS on it. Named, First, Last, Address..etc..i had it so that whatever record the user was viewing, when the button was clicked, the contacts address information was inserted over the bookmarks in the letter. Not sure if people understand that but i did it before.

my code looks like this so far...

Dim objWord As Object
Set objWord = CreateObject("Word.Basic")
objWord.AppShow
objWord.FileOpen ("a:letter.doc")


but now i need the code to replace each bookmark. For example, the field FirstName, would replace the bookmark First in the letter. And the field LastName would replace the bookmark Last.

Please help if you can.

-Stephen

Mongo
May 16th, 2000, 08:25 AM
This returns the bookmarks in a document by order of placement:


Sub GetBookMarksByPlacement()
Dim bmBookMark As Bookmark
For Each bmBookMark In ActiveDocument.Range.Bookmarks
MsgBox bmBookMark.Name
Next
End Sub