How do I add more than one attachment to the code below? Thank you.
Public Sub Command0_Click()
Dim otk As Outlook.Application
Dim eml As Outlook.MailItem
Dim rs As Recordset
' Open your table and build your distribution list
Set rs = New ADODB.Recordset
With rs
.Open "Table1", CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdTable
.MoveFirst
Do While Not .EOF
Set otk = CreateObject("Outlook.Application")
Set eml = otk.CreateItem(olMailItem)
eml.To = .Fields("EmailAddress")
eml.Subject = "Test Message"
eml.Body = "This is a test."
eml.Attachments.Add "C:\test.doc"
eml.Send
.MoveNext
Loop
.Close
End With
End Sub
Public Sub Command0_Click()
Dim otk As Outlook.Application
Dim eml As Outlook.MailItem
Dim rs As Recordset
' Open your table and build your distribution list
Set rs = New ADODB.Recordset
With rs
.Open "Table1", CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdTable
.MoveFirst
Do While Not .EOF
Set otk = CreateObject("Outlook.Application")
Set eml = otk.CreateItem(olMailItem)
eml.To = .Fields("EmailAddress")
eml.Subject = "Test Message"
eml.Body = "This is a test."
eml.Attachments.Add "C:\test.doc"
eml.Send
.MoveNext
Loop
.Close
End With
End Sub