ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel to pdf by code (https://www.excelbanter.com/excel-programming/277029-excel-pdf-code.html)

Daniel Bonallack[_2_]

Excel to pdf by code
 
I have looping code that makes various changes to an Excel
file, prints it, changes it again, prints it again and so
on for 100 iterations.

This works fine for printing to my network printer. But
when I print to Acrobat Distiller or PDF Writer, I then
have to wait by my PC and hit "Save" each time it comes to
print - 100 times.

Can someone please tell me how to print to pdf and execute
the Save prompt so I can leave my PC to work while I go
and have a cup of tea?

Thanks in advance,
Daniel





Jean-Paul Viel

Excel to pdf by code
 
Hi,



Use something like that in your Macro.



Static intN As Integer

Sheets("Sheet1").Select

Application.ActivePrinter = "Acrobat PDFWriter on LPT1:"

ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _

"Acrobat PDFWriter on LPT1:", PrintToFile:=True,
PrToFilename:="ThePDF" & Trim(Str(intN + 1))

intN = intN + 1



Have a nice cup of tea


--
JP

http://www.solutionsvba.com


"Daniel Bonallack" wrote in message
...
I have looping code that makes various changes to an Excel
file, prints it, changes it again, prints it again and so
on for 100 iterations.

This works fine for printing to my network printer. But
when I print to Acrobat Distiller or PDF Writer, I then
have to wait by my PC and hit "Save" each time it comes to
print - 100 times.

Can someone please tell me how to print to pdf and execute
the Save prompt so I can leave my PC to work while I go
and have a cup of tea?

Thanks in advance,
Daniel







Daniel Bonallack[_2_]

Excel to pdf by code
 
Thanks! (to someone who understands the need for a nice
cup of tea)


-----Original Message-----
Hi,



Use something like that in your Macro.



Static intN As Integer

Sheets("Sheet1").Select

Application.ActivePrinter = "Acrobat PDFWriter on

LPT1:"

ActiveWindow.SelectedSheets.PrintOut Copies:=1,

ActivePrinter:= _

"Acrobat PDFWriter on LPT1:", PrintToFile:=True,
PrToFilename:="ThePDF" & Trim(Str(intN + 1))

intN = intN + 1



Have a nice cup of tea


--
JP

http://www.solutionsvba.com


"Daniel Bonallack" wrote in

message
...
I have looping code that makes various changes to an

Excel
file, prints it, changes it again, prints it again and

so
on for 100 iterations.

This works fine for printing to my network printer. But
when I print to Acrobat Distiller or PDF Writer, I then
have to wait by my PC and hit "Save" each time it comes

to
print - 100 times.

Can someone please tell me how to print to pdf and

execute
the Save prompt so I can leave my PC to work while I go
and have a cup of tea?

Thanks in advance,
Daniel






.



All times are GMT +1. The time now is 05:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com