multiple attachments using Outlook from Access

  • Thread starter Thread starter Reg
  • Start date Start date
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
 
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
 
Try using multiple .add's

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

Hope this helps.
 
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.
 
Back
Top