
e-mail from Access via does not send merged Word document
Hi all,
I try to mail merge from Access to Word (which succeeds),
but then I want to send the generated letter as an
attachment with an e-mail message. As a matter of fact
letters should be generated with each time another
addressee and diffrent information in it. The query
generating the data works smoothly but the code gets stuck
on the .Execute line.
I get error 5630 telling me I have to input an addressee.
With oWord.ActiveDocument.MailMerge
.DataSource.ActiveRecord = wdFirstRecord
.ViewMailMergeFieldCodes = wdToggle
.MailAddressFieldName = strEmailAddress
.MailSubject = strSubject
.Destination = wdSendToEmail
.SuppressBlankLines = True
'''' the program generates an error on the next line
.Execute
With .DataSource
.FirstRecord =
ActiveDocument.MailMerge.DataSource.ActiveRecord
.LastRecord =
ActiveDocument.MailMerge.DataSource.ActiveRecord
End With
.Execute Pause:=False
End With
Why does it not function with e-mail ? Or what do I have
to do to be able to send an e-mail via VBAcode ?
Thanks in advance,
Wim