Page 1 of 1

[Solved] SysEmail "Attachment" Cmd to include multiple files

Posted: Sat Feb 26, 2011 8:30 am
by alf50
I Need the SystemEmail "Attachment" Command format to include multiple files in one email?

The Code I am using in Windows 7 and the Windows Live Mail, allows me to attach one file to the email, but I cannot figure out how to attach Multiple files.

The Code to attach one file that works is:

eMessage.setAttachement(Array(convertToUrl(sPath & "1.pdf")))

I have tried several variants of &, comas, semicolons, nested Array(convertUrl(...) but when I run the macro, nothing works.

eMessage.setAttachement(Array(convertToUrl(sPath & "1.pdf; " & sPath & "2.pdf; " & sPath & "3.pdf")))

Re: Need SystemEmail "Attachment" Command to include multipl

Posted: Sat Feb 26, 2011 8:50 am
by FJCC
The method setAttachment takes an array of URL's as its argument. If you want to do it in one line, I think what you need is

Code: Select all

eMessage.setAttachement(Array(convertToUrl(sPath & "1.pdf"), convertToURL(sPath & "2.pdf"), convertToURL(sPath & "3.pdf")))
It is probably cleaner to do it in multiple lines

Code: Select all

URL1 = convertToUrl(sPath & "1.pdf")
URL2 = convertToUrl(sPath & "2.pdf")
URL3 = convertToUrl(sPath & "3.pdf")
ArrayOfURL = Array(URL1, URL2, URL3)
eMessage.setAttachement(ArrayOfURL)
I didn't actually test the code. I hope there are no typos or silly mistakes.