I would like to send the same e-mail message to multiple addresses using a list box. I have been successful sending it to a single address but am struggling with multiple addresses. I would sincerely appreciate any help. Thanks.
Code used:
Dim ol As New Outlook.Application
Dim ns As Outlook.NameSpace
Dim newMail As Outlook.MailItem
Dim i As Integer
'Return a reference to the MAPI layer.
' Set ns = ol.GetNamespace("MAPI")
'Create a new mail message item.
Set newMail = ol.CreateItem(olMailItem)
For i = 0 To List4.ListCount - 1
With newMail
.Subject = "Training Information for October 1997"
.Body = "Here is the training information you
requested:" & vbCrLf
'Add a recipient and test to make sure that the
'address is valid using the Resolve method.
.Recipients.Add(List4.Selected(i))
.Type = olTo
If Not .Resolve Then
MsgBox "Unable to resolve address.",
vbInformation
Exit Sub
End If
.Send
End With
i = i + 1
Next
'Release memory.
Set ol = Nothing
' Set ns = Nothing
Set newMail = Nothing
Code used:
Dim ol As New Outlook.Application
Dim ns As Outlook.NameSpace
Dim newMail As Outlook.MailItem
Dim i As Integer
'Return a reference to the MAPI layer.
' Set ns = ol.GetNamespace("MAPI")
'Create a new mail message item.
Set newMail = ol.CreateItem(olMailItem)
For i = 0 To List4.ListCount - 1
With newMail
.Subject = "Training Information for October 1997"
.Body = "Here is the training information you
requested:" & vbCrLf
'Add a recipient and test to make sure that the
'address is valid using the Resolve method.
.Recipients.Add(List4.Selected(i))
.Type = olTo
If Not .Resolve Then
MsgBox "Unable to resolve address.",
vbInformation
Exit Sub
End If
.Send
End With
i = i + 1
Next
'Release memory.
Set ol = Nothing
' Set ns = Nothing
Set newMail = Nothing