+ Reply to Thread
Results 1 to 5 of 5

Attaching multiple files to an Outlook mail using Excel VBA

  1. #1
    Registered User
    Join Date
    12-31-2013
    Location
    Here
    MS-Off Ver
    Excel 2010
    Posts
    21

    Attaching multiple files to an Outlook mail using Excel VBA

    Hello,

    I've got a small macro that does the following:

    1. Save active sheet as PDF in a specified folder
    2. Create new mail item in Outlook
    3. Attach created sheet into new mail

    Then, I'll view it, and send.

    Now, I just need to tweak it a bit so that it'll search the specified folder for multiple .pdf files. The catch is that there will be lots of them, but each filename has a date on it. I need to attach just the ones that have the date I specify. For instance I want to attach all the PDF's that have today's date:

    1. OT_Sheet 17-08-15.pdf [x]
    2. OT_Graph 17-08-15.pdf [x]
    3. Media 01-02-15.pdf
    4. Media_Weekly 06-08-15.pdf
    5. Montly_report 17-08-15.pdf [x]

    How do I do that?

    Here's the code I've got so far (the file names and paths are all bogus, obviously, as I'll be changing them to the real ones later on, these are just test locations/names):

    Please Login or Register  to view this content.
    Last edited by lawrence24; 08-17-2015 at 03:39 AM.

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Attaching multiple files to an Outlook mail using Excel VBA

    Not sure if this will work, but, have you tried using Today() on your attachments line instead of Now()? Today just uses the date, Now uses the date AND time.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Registered User
    Join Date
    12-31-2013
    Location
    Here
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Attaching multiple files to an Outlook mail using Excel VBA

    It would work I'm guessing, but the problem is that the names differ. For instance, one file could be called "Bacon Wrap" followed by todays date. Another file could be called "Custom Sheets" followed by the date. The only thing common is the date.

  4. #4
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Attaching multiple files to an Outlook mail using Excel VBA

    My bad, a bit more complex then the solution I provided. I'm not sure how to include files that have different names but the same date.

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Attaching multiple files to an Outlook mail using Excel VBA

    Hi lawrence24

    You can try this...let me know of issues.
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA for attaching multiple files to mails
    By Big Chris in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-24-2016, 11:15 AM
  2. Replies: 0
    Last Post: 07-02-2014, 03:04 PM
  3. [SOLVED] Attaching and pasting excel sheet in to a new mail
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-26-2013, 06:05 PM
  4. [SOLVED] Attaching and pasting excel sheet in to a new mail
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-01-2013, 12:51 AM
  5. Attaching and pasting excel sheet in to a new mail
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-01-2013, 05:41 AM
  6. Macro for attaching files into Outlook email - 95% complete but....
    By heatwave in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-07-2013, 01:30 AM
  7. Replies: 1
    Last Post: 01-28-2009, 10:25 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1