+ Reply to Thread
Results 1 to 15 of 15

Send Excel file by email, but Not to Save

  1. #1
    Forum Contributor
    Join Date
    09-19-2003
    Posts
    226

    Send Excel file by email, but Not to Save

    Hi Folks

    I need to prepare an Excel file, send it by email, but not to save it, using a Macro. What must be entered into the subject field is found in a cell in the file. In this case, Cell E2. I've attached an example. No recipients to worry about.

    Many thanks

    Patish
    Patish

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Send Excel file by email, but Not to Save

    Start here:

    http://www.rondebruin.nl/win/section1.htm
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    09-19-2003
    Posts
    226

    Re: Send Excel file by email, but Not to Save

    Hi Alan

    Thanks for your quick reply and the link. Maybe I missed it, but the code in the examples deals mainly with addresses and bodies of emails. What I need is to enter the info in the cell E2 into the Subject field of the open email.

    Thanks

    Patish

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Send Excel file by email, but Not to Save

    In Ron's example below:

    Please Login or Register  to view this content.
    Replace this line of code:
    Please Login or Register  to view this content.
    with
    Please Login or Register  to view this content.

    Whichever code you use, just change up the Subject line to reflect the range containing the subject

  5. #5
    Forum Contributor
    Join Date
    09-19-2003
    Posts
    226

    Re: Send Excel file by email, but Not to Save

    Hi Alan

    Once again, many thanks.

    I have attached the file with the adapted Macro. I have deleted the recipient's address and have changed the "Send" to "Display" as I just need only to display the email and enter in the recipients' addresses manually.

    Here is the issue: The file that I want to send is actually a Worksheet that I have copied as a new Book. I want to send it immediately without saving it as a separate file. I tried to send the worksheet. The email is displayed, but the file is not attached. I reckon it does not attach because it is not a file yet??? Are you able to change the code accordingly?

    Another point: I will be placing a "Button" on the worksheet to activate the Macro. Where do I place the code in the macro to the delete the button before send the file?

    Apologies for the additional stuff.

    Much appreciated

    Patish
    Attached Files Attached Files

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Send Excel file by email, but Not to Save

    Why don't you save it and then, before end of macro, delete it?

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Send Excel file by email, but Not to Save

    I could be wrong, but I do not think there is a functionality within excel and Outlook what you are trying to do. If there is, I am sure, Ron, could have included it on his site and will not need to save an excel file.
    Application.Dialogs(xlDialogSendMail).Show

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

    Re: Send Excel file by email, but Not to Save

    as mentioned already

    extract worksheet

    create the "temp" file
    while creating the Temp file you can convert it to xlsx which will get rid of the button
    kill it after your are finished

    http://www.rondebruin.nl/win/s1/div/mail2.htm
    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.

  9. #9
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Send Excel file by email, but Not to Save

    As per suggested.

    Please Login or Register  to view this content.
    @humdingaling

    buttons get copied even as saved xlsx.
    See top of code to avoid that issue.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  10. #10
    Forum Contributor
    Join Date
    09-19-2003
    Posts
    226

    Re: Send Excel file by email, but Not to Save

    Hi Bakerman2

    Many thanks for your input. Just a small question: If I want to add in multiple email addresses how would the .to ="" be adapted? Above Alan had only one address and it's OK. However, I placed the ";" between the two addresses and it did not work. How do I add multiple addresses in the macro? As an alternative how do I go about adapting the macro to link to a list addresses on a spreadsheet in the same workbook? If I wish to add and delete addresses without changing the Macro each time.

    Tx

    Patish

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

    Re: Send Excel file by email, but Not to Save

    I placed the ";" between the two addresses and it did not work
    you must not be doing the syntax correctly

    anyway you can set a a range on your spreadsheet with email addresses
    then just loop that range and create the .to

    Please Login or Register  to view this content.
    then make

    Please Login or Register  to view this content.
    Last edited by humdingaling; 11-14-2016 at 08:44 PM.

  12. #12
    Forum Contributor
    Join Date
    09-19-2003
    Posts
    226

    Re: Send Excel file by email, but Not to Save

    Hi Humdingaling

    I am using Alan's code above. So I have replace the email address of Ron with " = sTo". The Range I have given a name. Now, where do I place your code?

    Tx

    Patish

  13. #13
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Send Excel file by email, but Not to Save

    Like this.

    Please Login or Register  to view this content.

  14. #14
    Forum Contributor
    Join Date
    09-19-2003
    Posts
    226

    Re: Send Excel file by email, but Not to Save

    Thank you Bakerman. Thank you Alan. Thank you everyone for your input. The Macro works like a charm.

    Once again thank you.

  15. #15
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Send Excel file by email, but Not to Save

    You're very welcome and thanks for adding rep points.

    If this answers your question please mark the thread as SOLVED. 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. [SOLVED] Excel Salary payslip save as pdf and automatically send email using outlook
    By fortknox in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-16-2022, 06:22 AM
  2. Open Excel, refresh, save and send via email.
    By Aerator in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-22-2015, 05:55 PM
  3. Replies: 2
    Last Post: 02-14-2014, 12:03 AM
  4. Excel 2010 file with VBA save and send code works-but file can't be found.
    By carlton.clay in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-13-2013, 09:46 AM
  5. Grouping data, save to a file and send via email HELP
    By d82k in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-10-2009, 01:47 PM
  6. VBA + Excel - Save ActiveSheet as hmt then Send Email
    By mariocatch in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-13-2007, 10:52 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