+ Reply to Thread
Results 1 to 13 of 13

SaveAs PDF Dialog Box

  1. #1
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    SaveAs PDF Dialog Box

    I have a workbook with a couple of commandbuttons for saving and printing pdf files. Paul got me fixup
    on the SaveAs problem I was having, one more problem. When I save a workbook it becomes that name and then I print out pdf
    file. When I save the file it shows up in the print dialog box to save, if I skip the save as button and just want the pdf file I have to type in the name. Here are my two codes,is it possible to have the pdf dialog box show the value in c16 without saving first.


    Please Login or Register  to view this content.
    PDF Button Code

    Please Login or Register  to view this content.

    Thanks
    Last edited by zplugger; 12-21-2011 at 05:02 PM.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: SaveAs Dialog Box

    If you had Excel 2007+ you could simply use the SaveAs PDF option built into the newer versions of Excel. With Excel 2003 you're stuck with CutePDF, pdfCreator or Adobe Acrobat (or other). Apparently CutePDF (the non-pro version) doesn't allow access to its interface using VBA, but pdfCreator (free) does.

    See examples here:
    http://www.excelguru.ca/content.php?...Early-Binding)
    http://www.excelguru.ca/content.php?...-Late-Binding)

    Here's another user (different forum) that has a similar problem and their discussion:
    http://www.ozgrid.com/forum/showthread.php?t=51635

    Hope that helps!

  3. #3
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Re: SaveAs Dialog Box

    Thanks Again Paul, will look at pdf creator

  4. #4
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Re: SaveAs Dialog Box

    OK I download the add-in for excel 2007,will this let me do what I want now?

  5. #5
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: SaveAs Dialog Box

    It should. If you record a macro while saving the file as PDF you can see the code it creates, e.g.
    Please Login or Register  to view this content.
    There are other options as well (saving only a selection as PDF, the entire workbook (all sheets) as PDF, etc.). Here's some info: http://msdn.microsoft.com/en-us/libr...ice.11%29.aspx

    Also, your profile lists Excel 2003. Does that need to be updated? If so, click "My Profile" at the top of this page, then select the "About Me" tab in the profile. Click the small pencil next to My Microsoft Office Version.

  6. #6
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Re: SaveAs Dialog Box

    Thanks Paul
    I tried a macro and put the code in a commandbutton,would not fire up. In my top code the SaveAs box defaults to cell C16 for the name, was not sure if
    this could be done when opening the pdf dialog. Now when you open the pdf dialog it defaults to active sheet, was hoping to have it default to a value in C16. I
    will update my profile to 2007
    z

  7. #7
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: SaveAs Dialog Box

    If you add a reference to C16 it should work. Also change the file path to your actual file path. Example:
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Re: SaveAs Dialog Box

    I Can't get the commandbutton to open the Publish as PDF or XPS dialog window, what I want is when it opens it has the value of C16
    in the file box to publish if possible. I will chose to save where in the dialog window. I hope to set what sheet or sheets it prints in the code.

    Z

  9. #9
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: SaveAs Dialog Box

    Hmm, with some fiddling I may have figured this out..
    Please Login or Register  to view this content.
    This will open the SaveAs dialog window with the filename from cell C16 on Sheet1, set to save as PDF. You can then choose where to save the file.

    Thanks to these two sites for the info:

    http://social.msdn.microsoft.com/For...6-46630bc02f95 (in Phil Hoff's reply)
    http://msdn.microsoft.com/en-us/libr...ice.12%29.aspx (PDF fileformat type in comments at very bottom)
    Last edited by Paul; 12-20-2011 at 07:44 PM.

  10. #10
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Re: SaveAs Dialog Box

    Thanks Paul your amazing,works perfect. I still have Dial-Up internet and its hard to find information like that. I will play
    around with the code to control what sheets it prints per invoice.
    Have a Great night Z

  11. #11
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Re: SaveAs Dialog Box

    This stuff is tuff, all I want to do is print 2 sheets out 0f 4 in pdf with a commandbutton.

    Private
    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Re: SaveAs Dialog Box

    This is what I want it to do, just no luck.Must be missing something in code?

    Application.Dialogs(xlDialogSaveAs).Show arg1:=Sheets("Sheet1").Range("C16").Value, arg2:=57
    Quality =(xlQualityStandard) _
    IncludeDocProperties:=True, IgnorePrintAreas:=False, From:=1, To:=2, _
    OpenAfterPublish:=True
    Z

  13. #13
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Re: SaveAs PDF Dialog Box

    Thanks for all your help Paul, from what I read you can't set the pages in this with vba. The dialog box opens great,just
    can't set what pages it prints.

    Z

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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