View Single Post
 
Old 07-16-2015, 06:42 AM
johnc83 johnc83 is offline Windows 7 64bit Office 2003
Novice
 
Join Date: Jul 2015
Posts: 6
johnc83 is on a distinguished road
Default

I've given up and written an alternative. Its Excel 2003 VBA that is creating the VBS file ready to send the email.

My sub receives a single string (Called 'Recipients') containing multiple email addresses and splits them out into individual ones..

Code:
'GET EMAIL ADDRESSES
EmailList = Recipients
For x = 0 To 10000
If InStr(EmailList, ";") = 0 Then 'if 0 then no more semi-colons meaning you are at last email address in list
x = 10000
Print #fnum, "objMailItem.Recipients.Add (""" & EmailList & """)"
Else
'Get position of semi-colin
SemiColPos = InStr(EmailList, ";")
'Get email address
EmailAddress = Mid(EmailList, 1, SemiColPos - 1)
Print #fnum, "objMailItem.Recipients.Add (""" & EmailAddress & """)"
'remove previous email address from list (by starting new string after first semiCol
EmailList = Mid(EmailList, SemiColPos + 1, 100)
End If
Next
Reply With Quote