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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with multiple email insert

Status
Not open for further replies.

patrichek

MIS
Nov 18, 2003
632
US
Hi, I have some code i found on this site that works by pulling 1 email address from a table and inserting the address into an email then sending it away.
I'd like to make it pull all the addresses in my table and put them into a single email. How should i change this code to make it use all email addresses?

Code:
Private Sub cmdSend_Click()
Dim strEmail, strBody As String
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

'**creates an instance of Outlook
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

'**************************************************************
'*create string with email address

strEmail = EmailName

strBody = EmailName & Chr(13) & Chr(13)
strBody = strBody & "We have received your information and are processing it promptly.  Please review the information" & " below to ensure our accuracy." & Chr(13) & Chr(13) & Chr(13)
strBody = strBody & "Sincerely," & Chr(13) & Chr(13)
strBody = strBody & "My Company"

'***creates and sends email
With objEmail
    .To = strEmail
    .Subject = "We have not received your Info"
    .Body = strBody
    .Send
End With


Set objEmail = Nothing
'****closes Outlook. remove if you do not want to close Outlook
objOutlook.Quit

Exit Sub

End Sub

thanks!
 
In the Outlook VBA help have a look at the MailItem.Recipients collection.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top