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?
thanks!
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!