Hi - me again!
I'm trying to send emails to several suppliers based on the data from a workbook. I've got pretty much all the way there by myself but the problem I'm having is that I need to display the emails before sending and when I ask excel to display the emails it simply adds all the attachments into a single email instead of creating a new email for each attachment.
In case that wasn't clear, I have (for instance) 5 suppliers, A, B, C, D and E. I want to send 5 emails, one to each, containing the appropriate workbooks 1, 2, 3, 4 and 5. I need to make minor changes to the email body before sending so I need to display each email in turn. At the moment my code ends up displaying one email, addressed to E, with all 5 workbooks attached.
Is there any way to get VBA to tell outlook to open a NEW email message, instead of just adding onto the currently open draft message?
My code is as follows:
Many thanks in advance for any assistance
I'm trying to send emails to several suppliers based on the data from a workbook. I've got pretty much all the way there by myself but the problem I'm having is that I need to display the emails before sending and when I ask excel to display the emails it simply adds all the attachments into a single email instead of creating a new email for each attachment.
In case that wasn't clear, I have (for instance) 5 suppliers, A, B, C, D and E. I want to send 5 emails, one to each, containing the appropriate workbooks 1, 2, 3, 4 and 5. I need to make minor changes to the email body before sending so I need to display each email in turn. At the moment my code ends up displaying one email, addressed to E, with all 5 workbooks attached.
Is there any way to get VBA to tell outlook to open a NEW email message, instead of just adding onto the currently open draft message?
My code is as follows:
Code:
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
.... some other stuff....
... then inside a for next loop: ...
With OutMail
.To = ActiveSupplierEmail
.CC = EmailCC
.BCC = ""
.Subject = EmailSubject
.Body = EmailBody
.Attachments.Add (SupplierBookPath)
.Display
End With
Many thanks in advance for any assistance