Hi,
I have some code that I've borrowed from elsewhere to enable me to run a mailmerge to email from access.
the problem i have is that when the merge begins it always creates a new document called "Electronic Message 1"
Here's the code...
Private Sub Command1_Click()
Set oApp = CreateObject("Word.Application")
oApp.Application.Visible = True
oApp.Application.Documents.Open "c:\ run query material.doc"
With oApp.ActiveDocument.mailmerge
.Destination = wdSendToEmail
.MailAsAttachment = True
.MailAddressFieldName = "EMail"
.MailSubject = "Material"
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False
End With
oApp.Quit
Set oApp = Nothing
End Sub
Also I'm trying to set the subject line as a mergefield..."Material" and also "Issue_Date" but this just isn't working...
any tips would be greatly appreciated!
thanks
B
I have some code that I've borrowed from elsewhere to enable me to run a mailmerge to email from access.
the problem i have is that when the merge begins it always creates a new document called "Electronic Message 1"
Here's the code...
Private Sub Command1_Click()
Set oApp = CreateObject("Word.Application")
oApp.Application.Visible = True
oApp.Application.Documents.Open "c:\ run query material.doc"
With oApp.ActiveDocument.mailmerge
.Destination = wdSendToEmail
.MailAsAttachment = True
.MailAddressFieldName = "EMail"
.MailSubject = "Material"
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False
End With
oApp.Quit
Set oApp = Nothing
End Sub
Also I'm trying to set the subject line as a mergefield..."Material" and also "Issue_Date" but this just isn't working...
any tips would be greatly appreciated!
thanks
B