Results 1 to 2 of 2
  1. #1
    tomswaelen is offline Novice
    Windows 8 Access 2013
    Join Date
    Oct 2015
    Posts
    1

    Trying to do a mail merge via MS Word - why not working?

    Total VBA newbie here, but I've been able to piece together a code with varying degrees of help. I'm trying to make a button that uses a Word-document to perform a mail merge direct to the printer, and then close.


    The code below opens the document that contains the mail merge data, but merges to a new document. What do I need to change?






    Code:
    
    Private Sub Mail_merge_starten_Click()
    
    
    Refresh
    
    
    DoCmd.SetWarnings False
    
    
    Dim WordApp As Object
    Set WordApp = CreateObject("word.Application")
    WordApp.Documents.Open "C:\Users\Tom\Desktop\Test\Resources\Opvragen officieel bewijs - NL.docm"
    WordApp.Visible = True
    
    
        With WordApp
            .ActiveDocument.MailMerge.OpenDataSource _
                Name:="C:\Users\Tom\Desktop\Test\Notarissen - opzoeken en opvolgen.accdb", _
                LinkToSource:=True, Connection:="Opvraging - te versturen", _
                SQLStatement:="SELECT * FROM [Opvraging - te versturen] WHERE Taal = ""N"""
    .ActiveDocument.MailMerge.Destination = wdSendToPrinter        
    .ActiveDocument.MailMerge.Execute
           
           
        End With
    End Sub

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,428

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 08-13-2014, 10:32 PM
  2. Mail Merge in Microsoft Word
    By imintrouble in forum Misc
    Replies: 0
    Last Post: 12-02-2011, 03:48 PM
  3. Mail merge with word
    By alexc333 in forum Access
    Replies: 0
    Last Post: 07-26-2011, 12:06 PM
  4. Mail merge from from Access to Word
    By williamgladstone in forum Access
    Replies: 1
    Last Post: 03-22-2011, 12:00 PM
  5. Mail Merge from Access to Word
    By Rachelkm2 in forum Programming
    Replies: 1
    Last Post: 05-29-2009, 02:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums