+ Reply to Thread
Results 1 to 4 of 4

Saving as a PDF on the active workbook Path and name same as active workbook name

  1. #1
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Saving as a PDF on the active workbook Path and name same as active workbook name

    Hello All,

    I have a code that sets page breaks, print area and saves as PDF. It is as follows

    Please Login or Register  to view this content.
    The above code asks the user to pick a location.

    But this time I want the code to
    • Use the activeworkbook's path and name and save it there.


    I tried
    Please Login or Register  to view this content.
    It didn't seem to work : Error Message was "Application defined or object defined error"

    Any help is much appreciated

    Thanks,

    Subbby
    Last edited by subbby; 11-22-2016 at 12:28 PM. Reason: Solved

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Saving as a PDF on the active workbook Path and name same as active workbook name

    Where did you get xlQualityHigh? You can use xlQualityMinimum or xlQualityStandard.

    You can not save an Excel file as a PDF. You can export it to PDF.

    The Immediate Window in the VBE shows the results of Debug.Print after a run. From that you can see that you need to replace .xlsm with .pdf in the export. Of course that fails in the export if you have not saved the Excel file first.

    A shortened version of yours for illustration.
    Please Login or Register  to view this content.
    Last edited by Kenneth Hobson; 11-22-2016 at 12:06 PM.

  3. #3
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Saving as a PDF on the active workbook Path and name same as active workbook name

    Quote Originally Posted by Kenneth Hobson View Post
    Where did you get xlQualityHigh? You can use xlQualityMinimum or xlQualityStandard.

    You can not save an Excel file as a PDF. You can export it to PDF.

    The Immediate Window in the VBE shows the results of Debug.Print after a run. From that you can see that you need to replace .xlsm with .pdf in the export. Of course that fails in the export if you have not saved the Excel file first.

    A shortened version of yours for illustration.
    Thank you, that worked like a charm.

    Appreciate your time and explanation.

    Helps a lot

    Thanks again

    Reputation star added !

    -Subbby

  4. #4
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Saving as a PDF on the active workbook Path and name same as active workbook name

    Quote Originally Posted by Kenneth Hobson View Post
    Where did you get xlQualityHigh? You can use xlQualityMinimum or xlQualityStandard.
    Not sure where I got it. I did try xlQualityStandard. However, xlQualityHigh did not yield any error messages.

+ 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] Code to detect previous active workbook instead of current active workbook
    By kosherboy in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 02-25-2014, 01:58 AM
  2. VBA macro for hyperlink to active workbook in the active workbook path
    By Scott Taylor in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-10-2013, 05:37 AM
  3. Renaming Active.Workbook and saving it without saving Macro
    By Djwill in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-04-2012, 03:09 AM
  4. Saving Active Workbook as Variable
    By amyxkatexx in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-10-2010, 02:27 AM
  5. Extracting a value from another (non-active) workbook using a path dynamically formed
    By WilliamCRodgers in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-16-2009, 07:37 AM
  6. active workbook path
    By vba-lover in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-22-2007, 01:41 AM
  7. Saving the Active Workbook
    By Lynn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-21-2006, 05:20 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