View Single Post
 
Old 08-22-2014, 08:24 AM
tariqaleed2 tariqaleed2 is offline Windows 7 32bit Office 2010 32bit
Novice
 
Join Date: Jul 2014
Posts: 14
tariqaleed2 is on a distinguished road
Default After the Mail Merge not show dialog box

This is merge Mail code FROM MS ACCESS IT Works fine, but in the end show dialog box SAVE AS . Is it possible to help FOR not show dialog box , but save AS the file directly IN "C:\Users\LABTOP2\Desktop\end_of_ the_merger.docx"
not use the sendkeys




Greetings to all
Attachment work files
Code:
Private Sub COMM1_Click() 
    Dim objWord As Word.Application 
    Dim Doc As Word.Document 
    Dim sDBPath As String 
    Set objWord = CreateObject("Word.Application") 
    objWord.Visible = False 'True
    Set Doc = objWord.Documents.Open(Application.CurrentProject. Path & "\WORD" & ".DOCX") 
    With Doc.MailMerge 
        .MainDocumentType = wdFormLetters 
        sDBPath = Application.CurrentProject.Path & "\DATA1" & ".XLS" 
        .OpenDataSource Name:=sDBPath, _ 
        SQLStatement:="SELECT * FROM `wordqur1$`" 
    End With 
    With Doc 
        .MailMerge.Destination = wdSendToNewDocument 
        .MailMerge.Execute Pause:=False 
    End With 
    Doc.Saved = True 
    objWord.Quit 
    Set Doc = Nothing 
    Set objWord = Nothing 
End Sub
Attached Files
File Type: zip saveas.zip (45.5 KB, 12 views)

Last edited by macropod; 08-23-2014 at 03:00 AM. Reason: Added code tags & formatting
Reply With Quote