+ Reply to Thread
Results 1 to 15 of 15

Modify email to only send a specific sheet.

  1. #1
    Forum Contributor
    Join Date
    01-21-2017
    Location
    England
    MS-Off Ver
    2007
    Posts
    409

    Modify email to only send a specific sheet.

    Hi I have the following code which make a copy of the workbook and prepares it to send in outlook. All of this works great what I'd like to do it modify it so that it I can send a specific sheet only rather than the whole document, is this possible?

    Please Login or Register  to view this content.
    Many thanks in advance

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Modify email to only send a specific sheet.

    how will you indicate what sheet in the workbook you will be sending? via activesheet?
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Modify email to only send a specific sheet.

    Please Login or Register  to view this content.
    maybe just add two bold lines

  4. #4
    Forum Contributor
    Join Date
    01-21-2017
    Location
    England
    MS-Off Ver
    2007
    Posts
    409

    Re: Modify email to only send a specific sheet.

    Hi thanks for your help, I was hoping I could indicated with sheet(s) by using the sheet names I wanted to attach however if that's too complicated the activesheet would still be very useful.

    I tried modifying the code as suggested. It still attaches the whole workbook in the email as before. However it also creates a new excel workbook in the background with a copy of the active sheet.

    Cheers

  5. #5
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Modify email to only send a specific sheet.

    replace this line
    Please Login or Register  to view this content.
    with whatever sheet you want to export and .copy
    ie
    Please Login or Register  to view this content.
    ohh i forgot the 2nd instruction

    replace
    Please Login or Register  to view this content.
    with
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    01-21-2017
    Location
    England
    MS-Off Ver
    2007
    Posts
    409

    Re: Modify email to only send a specific sheet.

    Hi thanks I did notice the wb1, wb2 issue and changed that however I still have the problems above.

    Cheers

  7. #7
    Forum Contributor
    Join Date
    01-21-2017
    Location
    England
    MS-Off Ver
    2007
    Posts
    409

    Re: Modify email to only send a specific sheet.

    Edit: I went through is again copying the larger code you provided: it's now copying book1 as an attachment great! however not as an excel document it's html..

  8. #8
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Modify email to only send a specific sheet.

    it did something strange on me as well
    i thought it was by your design
    its to do with this section

    Please Login or Register  to view this content.
    do you really need that formula for FileExtStr? if you just want XLSX?

  9. #9
    Forum Contributor
    Join Date
    01-21-2017
    Location
    England
    MS-Off Ver
    2007
    Posts
    409

    Re: Modify email to only send a specific sheet.

    Hi it was designed by someone else so I don't really know what's need or not tbh.

  10. #10
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Modify email to only send a specific sheet.

    in that case replacing

    Please Login or Register  to view this content.
    with

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    01-21-2017
    Location
    England
    MS-Off Ver
    2007
    Posts
    409

    Re: Modify email to only send a specific sheet.

    Thank perfect, many thanks for that!

  12. #12
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Modify email to only send a specific sheet.

    not a problem
    thanks for the rep

  13. #13
    Forum Contributor
    Join Date
    01-21-2017
    Location
    England
    MS-Off Ver
    2007
    Posts
    409

    Re: Modify email to only send a specific sheet.

    No worries, the only I have noticed is that I still get book1 open in the background which I then have to close, is it possible to do it without it opening in the background? Or automatically close book 1 once it’s attched to the email? It’s not a huge issue.

  14. #14
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Modify email to only send a specific sheet.

    doesnt that Book1 get changed to whatever you are saving?

    anyways
    wb2.SaveCopyAs TempFilePath & TempFileName & FileExtStr
    wb2.close SaveChanges:=False

  15. #15
    Forum Contributor
    Join Date
    01-21-2017
    Location
    England
    MS-Off Ver
    2007
    Posts
    409

    Re: Modify email to only send a specific sheet.

    Brilliant, again many thanks!

+ 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. Send Email, specific cases
    By aavelyn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-28-2013, 07:29 AM
  2. modify the VBA code to automatically send an email
    By kachuen2006 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-03-2012, 02:46 AM
  3. Modify VBA to send email with attachment
    By dip11 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-06-2012, 02:27 PM
  4. How to Send specific range via email
    By Zahhhaaaa in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-02-2011, 07:13 AM
  5. Automatically send an email from excel with specific data on specific date.
    By Angela1607 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-04-2009, 08:11 AM
  6. Send data from Excel in email from specific email account
    By eriknokc in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-05-2007, 05:02 PM
  7. macro to send excel sheet to specific email address
    By JonnieP in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-27-2005, 06:10 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