I tried searching throughout but could not find a definite answer. Rather people have only suggested alternatives to similar questions but not a proper answer.
My excel version is 2010.
I need to print multiple pages from multiple excel files to a single PDF file, the code for which I have already prepared. The only issue I am facing is with the below section where I need to send the print to a saved PDF file. The code wont move forward unless I type the file name and click save.
The relevant code is below
<code> Sub printout()
ActiveSheet.printout ActivePrinter:="Adobe PDF on Ne00:", From:=1, To:=1
SendKeys (Variable & ".pdf")
SendKeys "{Enter}"
End Sub</code>what is happening here is the first line of the code opens up the "Save PDF File As" dialogue box. Thereafter I am unable to execute the Sendkeys method to enter the file name and click save/enter. Which is what I want to achieve through the VB macro code and the same is my question here?
I also tried the below
<code> ActiveSheet.printout ActivePrinter:="Adobe PDF Son Ne00:", From:=1, To:=1, PrintToFile:=True, PrToFileName:="Path\PDFs\1.pdf"</code>but this gives me a Post Script error
"When you create a PostScript file you must rely on system fonts and use document fonts. Please go to the printer properties, Adobe PDF settings page and turn OFF the option Rely on system fonts only; do not use document fonts."
if I change the PDF settings as per the error message the file does save but it saves a corrupt file which is blank when I open the saved PDF file.
I also tried the exporttoPDF method but it gives me other different problems one of them being with respect to paper size which is a different question altogether and would not include it here. I tried various techniques to solve the paper size issue but does not solve my problem. just including the reference so that no one suggests the exporttoPDF alternative.
I need to resolve the issue with the .printout method only moreover now it has become an understanding issue wherein I have to understand how to resolve it.
In the save as dialogue box when my above code runs, If I enter the file name manually and click save then everything works perfectly. It is only the sendkeys part I am unable to figure out to automate the entering of filename and clicking save. Need the solution only using the .PRINTOUT
please let me know for any additional details.
My excel version is 2010.
I need to print multiple pages from multiple excel files to a single PDF file, the code for which I have already prepared. The only issue I am facing is with the below section where I need to send the print to a saved PDF file. The code wont move forward unless I type the file name and click save.
The relevant code is below
<code> Sub printout()
ActiveSheet.printout ActivePrinter:="Adobe PDF on Ne00:", From:=1, To:=1
SendKeys (Variable & ".pdf")
SendKeys "{Enter}"
End Sub</code>what is happening here is the first line of the code opens up the "Save PDF File As" dialogue box. Thereafter I am unable to execute the Sendkeys method to enter the file name and click save/enter. Which is what I want to achieve through the VB macro code and the same is my question here?
I also tried the below
<code> ActiveSheet.printout ActivePrinter:="Adobe PDF Son Ne00:", From:=1, To:=1, PrintToFile:=True, PrToFileName:="Path\PDFs\1.pdf"</code>but this gives me a Post Script error
"When you create a PostScript file you must rely on system fonts and use document fonts. Please go to the printer properties, Adobe PDF settings page and turn OFF the option Rely on system fonts only; do not use document fonts."
if I change the PDF settings as per the error message the file does save but it saves a corrupt file which is blank when I open the saved PDF file.
I also tried the exporttoPDF method but it gives me other different problems one of them being with respect to paper size which is a different question altogether and would not include it here. I tried various techniques to solve the paper size issue but does not solve my problem. just including the reference so that no one suggests the exporttoPDF alternative.
I need to resolve the issue with the .printout method only moreover now it has become an understanding issue wherein I have to understand how to resolve it.
In the save as dialogue box when my above code runs, If I enter the file name manually and click save then everything works perfectly. It is only the sendkeys part I am unable to figure out to automate the entering of filename and clicking save. Need the solution only using the .PRINTOUT
please let me know for any additional details.