Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2003

    Unanswered: Mail merge to Word instead of Access report


    I need to mail merge into Word using data from Access (e.g. tblCustomer - CustomerName, CustomerAddress). So, I have a tbl full of customer info, and I need to merge that data into a Word template letter (i.e. generic letter - "Hi [CustomerName] from [CustomerAddress]". I've searched the Microsoft kb but the closest thing I can find is "How to Use Automation to Create a Word 2000 Merge Document". This isn't suitable because the template letter/s I need to use have various Word specific features (e.g. Word bullet points, italics). Can any1 help? Ta
    "For all have sinned, and fallen short of the glory of God"

    - God speaking through Paul

  2. #2
    Join Date
    Apr 2004
    outside the rim
    Actually, you can completely control Word through the object model.

    Here's the gist to get you started, I have to leave out the mass of details to save time:

    1st, add Microsoft Word to the References

    Then, in code, dimension a variable as Word.Application
    Set the variable equal to a new instance of Word
    Then you can do anything with Word you want.

    Sounds like you want to open a template (which should have bookmarks in it), search for the bookmarks and insert text.

    The best way to learn how to get the code in Word is to open Word and start recording a macro. Mimic everything you want your code to do. When you're done, you'll have all the code you need to accomplish your task in Word (probably too much - you can edit it) in the Macro Editor.

    Copy and paste that code into Access and there's only 1 catch:
    Precede the code with this statement:
    With objWord
    (where objWord is your variable for Word)
    Precede every word object with a period
    Add this statement after the Word code:
    End With
    Have fun

  3. #3
    Join Date
    Jun 2003
    And don't know if this might hopefully help at all but I've got a free sample Access database and Word mail merge that you can download from my site and possibly use as a starting point for your database:
    J. Paul Schmidt, Freelance Web and Database Developer
    Access Database Sample, Web Database Sample, ASP Design Tips

Posting Permissions

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