Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    Jan 2003
    Location
    Central Florida, USA
    Posts
    505
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Word Merge vs. Access Rept (Acc 2003)

    I have a project with a short turnaround time, and would like advice if possible from those that have been down this path before.
    I have a database that will be used as a source for a hard copy document. The query will have approx 80 records and will be used to produce the output. I have a Word document that has been used historically. The document was not a mail merge, but instead just a "blank form" to be completed by the employee each time.

    My questions are:
    1. If I use the word document and the mail merge feature, is it possible to create the merge and print using VBA? (I tried recording a macro in Word, but apparently the record macro doesn't "see" File:Print.
    2. I can recreate the Word doc as an Access Report, and use Lebans' most excellent print to pdf routine, and also send to a local printer.

    From a user's perspective, which would be the better approach? Does anyone have experience printing to a designated printer in Word using a VBA module in Access?

    Thanks in advance for any ideas you can share.


    Ken

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Word Merge vs. Access Rept (Acc 2003)

    For a quickie, it's probably easier to take the existing document and set up mail merge with the Access query as data source. Add merge fields to the document.

    You can then use code like this to merge directly to the printer:

    With ActiveDocument.MailMerge
    .Destination = wdSendToPrinter
    .Execute
    End With

    If you search this forum for OpenDataSource or for .MailMerge, you'll find examples of automating a mail merge in Word from Access.

  3. #3
    4 Star Lounger
    Join Date
    Jan 2003
    Location
    Central Florida, USA
    Posts
    505
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: Word Merge vs. Access Rept (Acc 2003)

    Hans,

    You are the best! I had already read several of the Mail Merge post, notably Post: 731,295, and the followups. This is an awesome resource.
    FWI - is there a way to identify a specific printer in your ".Destination = wdSentToPrinter"?

    Thanks again!

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Word Merge vs. Access Rept (Acc 2003)

    You can't specify the printer in the MailMerge object. You have to set it using Application.ActivePrinter = "...". If you want to set the printer only temporarily, you can use code like

    Dim strPrinter As String
    ' Store current printer in variable
    strPrinter = Application.ActivePrinter
    ' Specify a printer
    Application.ActivePrinter = "Other Printer On LPT1:"
    ' Mail merge code goes here
    With ActiveDocument.MailMerge
    ...
    ...
    End With
    ' Restore original printer
    Application.ActivePrinter = strPrinter

    (This is code to be run from Word)

  5. #5
    4 Star Lounger
    Join Date
    Jan 2003
    Location
    Central Florida, USA
    Posts
    505
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: Word Merge vs. Access Rept (Acc 2003)

    Hans,

    Thanks!!

    Ken

Posting Permissions

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