Hello,
I am sure this has been discussed somewhere on this forum already, however, I cant find it! Been experimenting with some code. So far the code picks up the attachments from the list box but puts each one into a separate email. I want all attachments in listbox to be attached to the same email. Here's what I have:
I am sure this has been discussed somewhere on this forum already, however, I cant find it! Been experimenting with some code. So far the code picks up the attachments from the list box but puts each one into a separate email. I want all attachments in listbox to be attached to the same email. Here's what I have:
Code:
Private Sub Command2_Click()
Dim subject As String, Body As String
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
On Error Resume Next
Set OutApp = GetObject(, "Outlook.Application")
If OutApp Is Nothing Then
Set OutApp = CreateObject("Outlook.Application")
End If
On Error GoTo 0
For intCurrentRow = 0 To ProofList.ListCount - 1
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
ProofList.Selected(intCurrentRow) = True
.To = vbNullString
.subject = "Test Email"
.Body = vbNullString
.Attachments.Add Application.CurrentProject.Path & "\ContactProofs\" & ProofList.Column(2)
.Display
End With
Next intCurrentRow
Set OutMail = Nothing
Set OutApp = Nothing
End Sub