Reputation: 1659
I wrote a VBA script to send emails to an arbitrary number of contacts from an excel file. The excel file basically has a column of email address's and attachment's, where attachment's is the name of the file to attach to the email. What I want to do is be able to add multiple attachments, by separating each attachment by ;
in the attachments column and making the script go on to add the next attachment. The trouble I am having is I don't know how to do it without setting a fixed number of attachments for contacts. The scenario I am trying to capture is, one contact can have 3 attachments, another one could have 2 and another 0 attachments.
Upvotes: 0
Views: 727
Reputation: 26
You can split a text in a cell to an array, then just loop through the array.
Const DELIMITER = ";"
Dim strCellText as String, strAttachment as String
Dim strAttachments() As String
strCellText = 'load your cell text here
strAttachments = Split(strCellText, DELIMITER)
For Each strAttachment In strAttachments
'attach an attachment to a mail
Next
Upvotes: 1