View Full Version : Send Multiple Attachments Through Outlook Using Excel Template
Sonny Thind
05-06-2012, 08:57 PM
hi everyOne..
Glad to be on this Site.. it seems awesome already..
I am using this Macro from this thread "Excel template with macro for sending mails and attahment thru outlook"
http://www.excelfox.com/forum/f2/excel-template-macro-sending-mails-attahment-thru-outlook-142/ however I am trying to send multiple attachments on the same email --so how can I modify this code to support that ?
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
Excel Fox
05-06-2012, 09:43 PM
Sonny, welcome to ExcelFox. Try this for sending Outlook Mail with multiple attachments.
Sonny Thind
05-07-2012, 06:05 PM
Hi Excel Fox.
Thanks a lot for this.. this works wonderfully.. I am very thankful to all who created this. Please continue the good work..
Sonny Thind
05-07-2012, 07:03 PM
sorry however when I tried this on Office 2010 with .HTML file attachments (5)I keep getting a subscript error or Bad File name or Number..
are there any limitations to the file attachments?
thanks ...
Excel Fox
05-07-2012, 10:01 PM
Are you sure the extension of the files is .HTML? Or should it be .htm?
Sonny Thind
05-08-2012, 02:43 AM
I apologise for jumping the gun earlier. but this still not working.. I keep getting a
BAD FILE NAME OR NUMBER error now even for normal files.
So I moved the sheet1 code to the module to see if that would help and after debugging I still get the error on
If Len(Dir(Trim(Split(strAttachmentPath, ";")(lngLoop)))) <> 0 Then
Am I doing something incorrect?
This however works for a single file but not for multiple files...
Excel Fox
05-08-2012, 10:31 PM
Can you please check and confirm once again that it is working for 1 file, but not for more than 1 file
Sonny Thind
05-09-2012, 11:34 PM
OK I got it to work.. I think there is a problem with the "|" part of the code. So I just replaced it with a ";" and it worked .
the code looks like this.
'Add attachments to the message.
For lngLoop = LBound(Split(strAttachmentPath, ";")) To UBound(Split(strAttachmentPath, ";"))
If Not strAttachmentPath = "" Then
If Len(Dir(Trim(Split(strAttachmentPath, ";")(lngLoop)))) <> 0 Then
Set objOutlookAttach = .Attachments.Add(Trim(Split(strAttachmentPath, ";")(lngLoop)))
Else
MsgBox "Unable to find the specified attachment '" & Trim(Split(strAttachmentPath, ";")(lngLoop)) & "'. Sending mail anyway."
End If
End If
Next lngLoop
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.