Results 1 to 2 of 2

Thread: word bookmarks

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Posts
    9

    Angry

    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

  2. #2
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Leavenworth KS USA
    Posts
    482
    This returns the bookmarks in a document by order of placement:

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width