I have been using the Albert Kallal methodology to mailmerge from Access to Word. I would like to enhance the application to do a mailmerge to the email (outlook client) in lieu of a new Word document.
Has anyone already modified the code to handle this?
I have modified the code to output to email thru .destination wdSendToEMail, and at this time the application will open up the word document, and I see the email addresses populated properly, but the program does not continue and attempt to email the final documents. Any suggestions?
Here is the portion of code that I believe is suspect:
Thanks,
Svenman
Has anyone already modified the code to handle this?
I have modified the code to output to email thru .destination wdSendToEMail, and at this time the application will open up the word document, and I see the email addresses populated properly, but the program does not continue and attempt to email the final documents. Any suggestions?
Here is the portion of code that I believe is suspect:
Code:
WordDoc.MailMerge.OpenDataSource _
Name:=strMergeDataFile, _
ConfirmConversions:=False, _
ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="", WritePasswordDocument:="", _
WritePasswordTemplate:="", Revert:=False, Format:=0, _
Connection:="", SQLStatement:="", SQLStatement1:=""
With WordDoc.MailMerge
.Destination wdSendToEmail
.MailAsAttachment = False
.MailAddressFieldName = "EMail"
' .MailAddressFieldName = "Sven@XYZ.COM"
' Above line used for testing to confirm that EMail Address is not a problem...
.MailSubject = "A Test"
.SuppressBlankLines = True
With .datasource
.FirstRecord = 1
' .LastRecord = 1
End With
.Execute Pause:=False
End With
Set WordDocM = wordApp.ActiveDocument
MyPbar.IncOne ' step 4, doc is merged
WordDoc.Close (False)
End Function
Thanks,
Svenman