Announcement

Collapse
No announcement yet.

Suppress Save dialog when using Foxit PDF from Excel VBA

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Suppress Save dialog when using Foxit PDF from Excel VBA

    Im wanting to automate printing my excel worksheets to PDF using "Foxit Reader PDF Printer". I have the following VBA code that i amusing:

    ActiveWindow.SelectedSheets.PrintOut _
    Copies:=1, _
    Preview:=False, _
    ActivePrinter:="Foxit Reader PDF Printer", _
    PrintToFile:=True, _
    PrToFileName:="D:\!NICS\Documents\! WORK\INVOICES\test9.pdf", _
    IgnorePrintAreas:=True

    Even though I have specified 'PrintToFile'= True' and have the "PrToFileName" path and name filled in, it still pops up a dialog box which I would like to bypass, is this possible?

    When using microsofts built in "Microsoft Print to PDF" printer it does not bring up any dialog box and saves the pdf accordingly, but has a much larger file size.

    I have also downloaded the Foxit Reader SDK Lib but am not sure if I can use this from Excel VBA to do what I want. I assume this is only used to drive Foxit PDF program?


  • #2
    Hi niczoom,

    Sorry, now Foxit Reader does not support Excel VBA, but I have reported your requirement to our team, they will consider it in future version, report ID:Phantom-484

    Would you please add the target folder and check the option"Use default filename and save to default folder" in Foxit printer properties dialog box, then you will not get save dialog box?

    Comment


    • #3
      Thanks for the reply.

      I did as you mentioned and also setup the target folder. But, the way i currently have my invoices setup, which is on individual sheets in excel does not work with this method.

      As mentioned before, using excels vba 'PrintOut' method, which lets me set the output path and filename, but foxit does not take this into account when printing using the ActivePrinter:="Foxit Reader PDF Printer". It would be great to use foxit in this way, hopefully, as you mentioned, the foxit team will support this in a future version.

      But I believe I can use what u suggested, if I set the option "Use default filename and save to default folder" along with a target folder. I can rework my vba code to individually save each invoice as a seperate xls file, then rename this file to reflect the invoice details then reload it and print if using Foxit with the option "Use default filename and save to default folder" checked.

      I do prefer foxit as the file size is much smaller, approx 65kB vs 230kB for "Microsoft Print to PDF".

      Comment


      • #4
        Hi Niczoom,

        Thank you for your feedback, it is a good news that the workaround helps you.

        Comment


        • #5
          Hello, I have the exact same question and want to know if you have made any progress on this subject.

          I really prefer foxit pdf printer to microsoft PDF printer and I also want to set the name from VBA.

          Thank you for your help!

          Comment


          • #6
            Originally posted by easytherm View Post
            Hello, I have the exact same question and want to know if you have made any progress on this subject.

            I really prefer foxit pdf printer to microsoft PDF printer and I also want to set the name from VBA.

            Thank you for your help!
            Dear easytherm,

            Thanks for your post.Foxit PhantomPDF will support Excel VBA in the next major release version 9.0 if everything goes well. Please keep an eye out for the new major version.




            Comment


            • #7
              Hi Lisa,

              Do you know if this functionality made it into v9.0? I am trying to print from Excel VBA with Foxit Reader 9.0.1.1049 but cannot specify the name of the PDF file. It is always set as the name of the workbook, which is no good when I want to print multiple sheets from the workbook separately.

              Here's my VBA code:

              ActiveSheet.PrintOut ActivePrinter:="Foxit Reader PDF Printer", PrintToFile:=True, PrToFileName:=reportName

              Thanks,
              Rich

              Comment


              • #8
                Dear Rich,

                Thanks for your post. In V9.0,we support VBA script to have PhantomPDF work with MS Office.
                For the API reference to communicate with PhantomPDF, please refer to API Reference for Application Communication document:
                http://cdn01.foxitsoftware.com/pub/f...munication.pdf
                You will find that you are able to specific the converted PDF file in the convert function.
                Following is an example:
                Converting non-PDF to PDF
                Dim phCreator As PhantomPDF.Creator
                Set phCreator = phApp.Creator
                Call phCreator.ConvertToPDF("D:\image.png", " D:\image.png.pdf")
                Call phCreator.ConvertToPDF("D:\excel.xlsx", "D:\excel.xlsx.pdf")

                Comment

                Working...
                X