Hi there
I have a Listbox on my form with the name and email address. The email address is in column 1. Listbox name is ContactList
I want to send the same email to a few selected recipients from the Listbox.
I get as far as to Display the Email Message but it has a 0 in the place of the email address.
I'm not sure how to specify that the email address is in Column 1 of the Listbox.
I have a Listbox on my form with the name and email address. The email address is in column 1. Listbox name is ContactList
I want to send the same email to a few selected recipients from the Listbox.
I get as far as to Display the Email Message but it has a 0 in the place of the email address.
I'm not sure how to specify that the email address is in Column 1 of the Listbox.
Code:
Private Sub cmdEmail_Click()
Dim OutMail As Outlook.MailItem
Dim OutApp As New Outlook.Application
Dim strbody As String
Dim strEmailRecipients As String
Dim strFirstName As String
Dim I As Integer
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strFirstName = FirstName
strbody = "Dear " & FirstName & "<br><br>" _
& "We have now submitted the Change of Ownership form. <br><br>"
With OutMail
For I = 0 To Forms!frmEmailContacts!ContactList.ListCount - 1
I = ContactList.Selected(I)
.To = I
.Subject = "Change of Ownership"
.HTMLBody = strbody
.Display
OutMail = Nothing
OutApp = Nothing
Next
End With
End Sub