Results 1 to 8 of 8

Thread: Send Multiple Attachments Through Outlook Using Excel Template

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    Sep 2011
    Posts
    7
    Rep Power
    0

    Send Multiple Attachments Through Outlook Using Excel Template

    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"
    HTML Code:
    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
    Attached Files Attached Files
    Last edited by DocAElstein; 06-10-2023 at 03:38 PM.

  2. #2
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    Sonny, welcome to ExcelFox. Try this for sending Outlook Mail with multiple attachments.
    Attached Files Attached Files
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  3. #3
    Junior Member
    Join Date
    Sep 2011
    Posts
    7
    Rep Power
    0
    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..

  4. #4
    Junior Member
    Join Date
    Sep 2011
    Posts
    7
    Rep Power
    0
    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 ...

  5. #5
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    Are you sure the extension of the files is .HTML? Or should it be .htm?
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  6. #6
    Junior Member
    Join Date
    Sep 2011
    Posts
    7
    Rep Power
    0
    I apologise for jumping the gun earlier. but this still not working.. I keep getting a
    HTML Code:
    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
    HTML Code:
    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...

  7. #7
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    Can you please check and confirm once again that it is working for 1 file, but not for more than 1 file
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  8. #8
    Junior Member
    Join Date
    Sep 2011
    Posts
    7
    Rep Power
    0
    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.

    Code:
       '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

Similar Threads

  1. Replies: 12
    Last Post: 12-10-2019, 09:56 PM
  2. Replies: 26
    Last Post: 10-22-2019, 02:39 PM
  3. Replies: 6
    Last Post: 06-05-2013, 11:33 PM
  4. Replies: 2
    Last Post: 01-07-2013, 04:34 PM
  5. Outlook Send Mail With Multiple Recipient and CC
    By noobtron in forum Excel Help
    Replies: 2
    Last Post: 10-31-2012, 07:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •