multiple attachments using Outlook from Access

R

Reg

I am successfully using code from
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dno2k3ta/html/odc_ac_olauto.aspto use an Outlook application object from Access and send an email with anattachment.However I cannot attach more than one file to an email.Here are the lines pertaining to this:Sub sbSendMessage(Optional AttachmentPath)...Set objOutlookMsg = objOutlook.CreateItem(olMailItem) With objOutlookMsg...Set objOutlookAttach = .Attachments.Add(AttachmentPath)I have tried separating the file names (that make up AttachmentPath string)with commas, semicolons, and spaces, all to no avail.Is there some way that I can compose the AttachmentPath string such thatOutlook will attach more than one file?ThanksReg
 
R

Reg

Sorry for the lack of linefeeds in that message. I do not understand why it
happened, and would be grateful if someone could enlighten me.
I hope this will turn out better.

I am successfully using code from
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dno2k3ta/html/odc_ac_olauto.asp
to use an Outlook application object from Access and send an email with
anattachment. However I cannot attach more than one file to an email.Here
are the lines pertaining to this:

Sub sbSendMessage(Optional AttachmentPath)
....
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
....
Set objOutlookAttach = .Attachments.Add(AttachmentPath)

I have tried separating the file names (that make up AttachmentPath
string)with commas, semicolons, and spaces, all to no avail.Is there some
way that I can compose the AttachmentPath string such thatOutlook will
attach more than one file?

Thanks
Reg
 
A

Andrew Tapp

Try using multiple .add's

Set objOutlookAttach = .Attachments.Add(FirstAttachmentPath)
Set objOutlookAttach = .Attachments.Add(SecondAttachmentPath)
etc.

Hope this helps.
 
R

Reg

Thanks Andrew
That fixed it

Andrew Tapp said:
Try using multiple .add's

Set objOutlookAttach = .Attachments.Add(FirstAttachmentPath)
Set objOutlookAttach = .Attachments.Add(SecondAttachmentPath)
etc.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top