+ Reply to Thread
Results 1 to 7 of 7

Save workbook, attach it to outlook email, close workbook?

  1. #1
    Registered User
    Join Date
    03-05-2014
    Location
    Tampa, FL
    MS-Off Ver
    Excel 2010
    Posts
    28

    Save workbook, attach it to outlook email, close workbook?

    I have a macro which I call from other macros, which saves the workbook with a new name based on the content of 2 cells in the active sheet, and then closes the newly saved workbook.

    I need to add a code that will attach the newly saved file to a new outlook email. The email doesn't need the addressee populated, but it would be cool if it populated the subject with the same name as the saved file (minus the file extension). Then close the workbook, but leave the email up and ready for the user to fill in the address and body and send it manually.

    Please Login or Register  to view this content.
    I've seen a number of discussions on variants of this online, but I couldn't figure out how to adapt it to this.

  2. #2
    Forum Contributor
    Join Date
    04-03-2012
    Location
    Washington State
    MS-Off Ver
    Excel 365
    Posts
    340

    Re: Save workbook, attach it to outlook email, close workbook?

    Here is a great example by www.Rondebruin.nl

    Please Login or Register  to view this content.
    Can you adapt this to your needs?

  3. #3
    Registered User
    Join Date
    03-05-2014
    Location
    Tampa, FL
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Save workbook, attach it to outlook email, close workbook?

    I've seen that stuff around, but don't know enough to adapt it.

  4. #4
    Forum Contributor
    Join Date
    04-03-2012
    Location
    Washington State
    MS-Off Ver
    Excel 365
    Posts
    340

    Re: Save workbook, attach it to outlook email, close workbook?

    Place this code in a module in your workbook and run the macro with Outlook open.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-05-2014
    Location
    Tampa, FL
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Save workbook, attach it to outlook email, close workbook?

    I did. It gave me a Compile Error: Syntax error.

    I thought it would be just a few lines of code added after the file is saved. That subscript you posted looks like it adds prepopulated text for the body and all kinds of stuff I don't need and also won't know how to chop out of there. Which lines do I need to simply attach the newly saved workbook as an attachment to a new Outlook email? I have no idea.

  6. #6
    Forum Contributor
    Join Date
    04-03-2012
    Location
    Washington State
    MS-Off Ver
    Excel 365
    Posts
    340

    Re: Save workbook, attach it to outlook email, close workbook?

    There is several ways you can perform this, but none of them are just a few lines of code to get this done. If you have a workbook containing macros, do you want to email a copy of the workbook without macros? If so, you can add the code to your "Master Workbook" and then email copies with no code attached like this. This is very similar to the code you have, just modify it.

    Please Login or Register  to view this content.
    Then call the email macro:

    Please Login or Register  to view this content.
    You could have two modules to perform this task. If you are unable to perform any of this, you might have to post your workbook and I can add this for you to make it work.

  7. #7
    Registered User
    Join Date
    03-05-2014
    Location
    Tampa, FL
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Save workbook, attach it to outlook email, close workbook?

    I figured it out.

    Please Login or Register  to view this content.
    Thanks though.

+ 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. Replies: 1
    Last Post: 03-11-2014, 12:44 PM
  2. Launch email and attach open workbook to email?
    By mlefkowitz in forum Excel General
    Replies: 0
    Last Post: 09-11-2012, 02:01 PM
  3. How to open,save and close another workbook from the current workbook using macro?
    By ravikumar00008 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-15-2012, 10:42 AM
  4. Macro to attach workbook to Outlook email but NOT send
    By kbwilsdon in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-11-2009, 06:57 AM
  5. Email workbook AND attach a separate file to the email
    By sgreni in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-15-2009, 06:48 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