+ Reply to Thread
Results 1 to 4 of 4

Excel 2016, VBA, Multiple sheets as separate attachments in 1 email

  1. #1
    Registered User
    Join Date
    05-23-2018
    Location
    nederland
    MS-Off Ver
    2016
    Posts
    26

    Excel 2016, VBA, Multiple sheets as separate attachments in 1 email

    Hi,

    I can't seem to solve the problem to add multiple attachments from different sheets (all from the same workbook), where i wish to add each sheet as separate workbook as an attachment into one email through a VBA macro script.

    I did find several sites that show how to add a single workbooksheet as an attachment, which is easy enough to get working. This principle uses the 'active workbook / activesheet' to create a new workbook in the background from a single existing sheet. then add it as attachement and after that kill the temporary workbook on the harddrive.

    Somehow i got it to get this script working for 2 separate workbooksheets as an attachement in 1 email, although i have no clue why this works, and more sheets give an error '53' or other errors.

    As additional info, i use a form control button to get the macro working where i added some additional lines in the emailscript to get some information in the body. subject and other parts of the email. I also need that button to copy some data to the sheets before they are copied. Now this all works fine for the script below with 2 separate attachments.

    I still need to add one more sheet as a separate workbook attachement to that same emailscript. If anyone can help me overcome this problem without receiving errors i would be very gratefull.

    My current already working script is:
    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Excel 2016, VBA, Multiple sheets as separate attachments in 1 email

    Change the names of the attached sheets to suit

    For Each ws In Sourcewb.Sheets(Array("Sheet1", "Sheet2", "Sheet3")) 'Array of sheets to add as workbooks

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    05-23-2018
    Location
    nederland
    MS-Off Ver
    2016
    Posts
    26

    Re: Excel 2016, VBA, Multiple sheets as separate attachments in 1 email

    Hi Alpha Frog,

    Thanks for the reply.
    i notice you cleaned up my current code with some additional dim and better logic in where which part of code should be placed.
    I'll try and test your stated codescript tonight or tomorrow, then i'll get back here to state if it works

    Regards,

    Arnoud Holtzer

  4. #4
    Registered User
    Join Date
    05-23-2018
    Location
    nederland
    MS-Off Ver
    2016
    Posts
    26

    Thumbs up Re: Excel 2016, VBA, Multiple sheets as separate attachments in 1 email

    Hi,

    Thanks for the given code. With a little adjustments i got it fully working now
    This code is used for emailing with multiple attachments and auto signature and data extracted from the workbook
    to use in multiple ways, for example as body, mailadresses, template data related to buttonlocation and more.
    Below the final working code:
    Please Login or Register  to view this content.

+ 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. [SOLVED] Issue send email with excel 2016 true outlook 2016
    By kirana2014 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-12-2017, 11:34 AM
  2. Help! Automated Email coding for Excel 2016 and Outlook 2016 problems
    By lisa6421 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-01-2017, 08:07 AM
  3. Replies: 6
    Last Post: 09-01-2017, 12:36 AM
  4. Sending Email with Multiple Attachments from Excel
    By Lisa4legin in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-29-2013, 03:24 PM
  5. email attachments of separate worksheets
    By tarmon in forum Excel General
    Replies: 0
    Last Post: 06-29-2012, 10:59 AM
  6. adding multiple attachments to a macro in excel for a email using outlook
    By ccbltdneedhelp in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-12-2009, 11:03 AM
  7. Can I save multiple email attachments using excel automatically?
    By ir26121973 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 03-18-2006, 03:00 PM

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