Results 1 to 13 of 13

SaveAs PDF Dialog Box

Threaded View

  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.


    Dim varFullName As Variant
        Dim strFileName As String
    
        Cancel = True
    
        strFileName = ThisWorkbook.Sheets("proposal").Range("c16").Value
    varFullName = Application.GetSaveAsFilename(InitialFileName:=strFileName, _
                                                    fileFilter:="Microsoft Excel Binary Workbook (*.xlsb), *.xlsb")
    
        If varFullName <> Cancel And varFullName <> False Then
              On Error GoTo FileNotSaved
                  Application.EnableEvents = False
                     ThisWorkbook.SaveAs Filename:=varFullName, FileFormat:=50
                  Application.EnableEvents = True
        End If
    
        Exit Sub
    PDF Button Code

    Dim DEFprinter As String
        'store default printer
        DEFprinter = Application.ActivePrinter
    Application.ActivePrinter = "CutePDF Writer on CPW2:"
        ActiveWindow.SelectedSheets.PrintOut From:=1, To:=2, Copies:=1, ActivePrinter:= _
            "CutePDF Writer on CPW2:", Collate:=True
           ' change back to default printer
        Application.ActivePrinter = DEFprinter

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

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