+ Reply to Thread
Results 1 to 7 of 7

VBA code to save current worksheet as temporary PDF file and then add to my existing code

  1. #1
    Registered User
    Join Date
    04-18-2012
    Location
    Shreveport, LA, USA
    MS-Off Ver
    Office 2013
    Posts
    63

    VBA code to save current worksheet as temporary PDF file and then add to my existing code

    Okay, so here's what I have. I'm using the following code to send out a daily report workbook. But I need to also create a temporary PDF version of the current worksheet (the actual report worksheet), named identical to the Excel file but with PDF instead of xlsm of course, and attach that PDF file to my email along with my Excel file.

    Here's what I'm using for just sending out the Excel file, with body text also referencing a PDF version.

    Please Login or Register  to view this content.
    Thank you.

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,173

    Re: VBA code to save current worksheet as temporary PDF file and then add to my existing c

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-18-2012
    Location
    Shreveport, LA, USA
    MS-Off Ver
    Office 2013
    Posts
    63

    Re: VBA code to save current worksheet as temporary PDF file and then add to my existing c

    Thank you, ranman, for such a quick reply. I'm not sure of the mechanics of this, being that I'm not very good with VBA, so could you please help me with the following:

    How can I make this work with my Mail_Report and include the resulting PDF file with the Excel file in the email, if possible?

    Thank you.

  4. #4
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,173

    Re: VBA code to save current worksheet as temporary PDF file and then add to my existing c

    This macro would have to return the new file (pvFile ) so you can ATTACH it like you did the other file.
    Or just put this code inside your macro just above the SEND command...
    .Attachments.Add pvFile

  5. #5
    Registered User
    Join Date
    04-18-2012
    Location
    Shreveport, LA, USA
    MS-Off Ver
    Office 2013
    Posts
    63

    Re: VBA code to save current worksheet as temporary PDF file and then add to my existing c

    Okay, sorry to be such a dolt, but I can't seem to make it work. Here's what I have, with the sub routine you posted first and then the one I already had below it (and with the line added that you mentioned above).

    Please Login or Register  to view this content.

  6. #6
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,173

    Re: VBA code to save current worksheet as temporary PDF file and then add to my existing c

    Sorry, I did see some typos....here it is corrected into a single SUB...

    Please Login or Register  to view this content.
    Last edited by ranman256; 05-20-2014 at 02:12 PM.

  7. #7
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,173

    Re: VBA code to save current worksheet as temporary PDF file and then add to my existing c

    Note: always use OPTION EXPLICIT to help find typos!

+ 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. VB Code to Save file as 97-2003 Worksheet
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-24-2014, 09:46 PM
  2. [SOLVED] Modify Existing Mbr Code to Save to Ext.Workbook
    By Miskondukt in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 03-06-2013, 02:36 PM
  3. [SOLVED] Saving temporary text file to particular location with the name of current Date and Time
    By muralidaran in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-06-2012, 10:46 AM
  4. Code to save current worksheet and hidden worksheet
    By fusion007 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-22-2011, 02:28 PM
  5. Replies: 2
    Last Post: 03-17-2011, 08:55 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