+ Reply to Thread
Results 1 to 9 of 9

Saving ActiveSheet as PDF

  1. #1
    Registered User
    Join Date
    12-04-2018
    Location
    Chicago
    MS-Off Ver
    2010
    Posts
    28

    Question Saving ActiveSheet as PDF

    Hi all,

    Creating a sub to save the active sheet as a PDF with the file name as "Warta Sklepik Invoice #:E4" as a PDF on my desktop. I have nearly all of it working except the actual saving as a PDF. Any pointers where I went wrong here? I keep getting a syntax error.
    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,538

    Re: Saving ActiveSheet as PDF

    If you change this
    Please Login or Register  to view this content.
    to this
    Please Login or Register  to view this content.
    Does that make a difference?

  3. #3
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,153

    Re: Saving ActiveSheet as PDF

    Quote Originally Posted by UAL225 View Post
    ... I keep getting a syntax error ...
    Try:
    Please Login or Register  to view this content.
    Don't use "Name" as a variable name, it's reserved word in vba.
    Don't use ":" in the filename.

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: Saving ActiveSheet as PDF

    .
    Another method:

    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,538

    Re: Saving ActiveSheet as PDF

    These 4 lines can be shortened from
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    and these 3 lines
    Please Login or Register  to view this content.
    can be replaced by to
    Please Login or Register  to view this content.
    I see that the first suggestion has been mentioned already.

  6. #6
    Registered User
    Join Date
    12-04-2018
    Location
    Chicago
    MS-Off Ver
    2010
    Posts
    28

    Re: Saving ActiveSheet as PDF

    It did not make a difference :-/

  7. #7
    Registered User
    Join Date
    12-04-2018
    Location
    Chicago
    MS-Off Ver
    2010
    Posts
    28

    Re: Saving ActiveSheet as PDF

    Thanks for these shorter methods! I prefer using the longer way to I can see where the code breaks! But I did update the code to make it shorter.

  8. #8
    Registered User
    Join Date
    12-04-2018
    Location
    Chicago
    MS-Off Ver
    2010
    Posts
    28

    Re: Saving ActiveSheet as PDF

    Got it to work with this method and a little tweaking!

  9. #9
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: Saving ActiveSheet as PDF

    .
    You are welcome. Glad to help.

+ 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] Saving activesheet as .csv with | as column seperator
    By MrMyagiii in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-21-2019, 09:48 AM
  2. [SOLVED] ActiveSheet.Name = ActiveSheet.Range("G1"), Worksheet_Calculate Event not working, 1004
    By xlyfe in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-28-2018, 11:24 AM
  3. [SOLVED] Undo "ActiveSheet.UsedRange.Value = ActiveSheet.UsedRange.Value" after copy
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-26-2016, 06:35 AM
  4. ActiveSheet.PivotTables => How to do it for custom sheet? (replace ActiveSheet)
    By chrisignm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-03-2014, 03:22 PM
  5. Error in Excel 2007 from 2003 version: saving ActiveSheet as prn file
    By plane-crazy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-03-2011, 07:26 AM
  6. Saving activesheet error
    By ankurzvohra in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-15-2008, 07:38 AM
  7. Copying new activesheet after other activesheet is hidden?
    By Simon Lloyd in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2006, 05:10 AM

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