Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mass E-Mail Question 1

Status
Not open for further replies.

Caryisms

Technical User
Oct 17, 2001
132
US
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
 
Just add an extra line, so instead of just
eml.Attachments.Add "C:\test.doc"

you have
eml.Attachments.Add "C:\test.doc"
eml.Attachments.Add "C:\test2.xls"

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top