![]() |
Creating PDF from Excel Using PrintToFile
Hello,
I've looked through the web to learn that if I want to convert Excel to PDF and give it a specific name (automatically) through macro I should use ....printout PrintToFile:=True, PRtoFileName:="I/....xx.pdf" But there's an error accessing the created pdf. It's all due to PrintToFile functionality. If I change destination file name extension to .prn, then it works. However, when I double click on this .prn file it asks me to choose a program. It then converts it to adobe acrobat file. It's there a more direct way to create from excel to pdf and having file name as variable? My intention is to create batches of pdfs from excel and through macro emailing out to people. I want to skip the step of converting from .prn to .pdf (haven't figured how I would do it). Thanks, Carmen |
Creating PDF from Excel Using PrintToFile
You can install a PDF printer driver such as PDF995
make the PDF driver driver the default printer in Windows "Carmen" wrote in message ... Hello, I've looked through the web to learn that if I want to convert Excel to and give it a specific name (automatically) through macro I should use ...printout PrintToFile:=True, PRtoFileName:="I/....xx.pdf" But there's an error accessing the created pdf. It's all due to PrintToFile functionality. If I change destination file name extension to .prn, then it works. However, when I double click on this .prn file it asks me to choose a program. It then converts it to adobe acrobat file. It's there a more direct way to create from excel to pdf and having file name as variable? My intention is to create batches of pdfs from excel and through macro emailing out to people. I want to skip the step of converting from .prn to .pdf (haven't figured how I would do it). Thanks, Carmen |
Creating PDF from Excel Using PrintToFile
The free PDFCreator is another similar, and IMO better option. The
following macro shows how to change the printer and print the document at runtime. Source: <http://www.exceltip.com/st/Change_the_default_printer_using_VBA_in_Microsoft_ Excel/453.html You'll need to keep the name of the PDF printer consistent on all workstations, or store the name of the PDF printer somewhere and read it at runtime. This macro has it hardcoded to a specific fax device. Sub PrintToAnotherPrinter() Dim STDprinter As String STDprinter = Application.ActivePrinter Application.ActivePrinter = "microsoft fax on fax:" ' change printer ActiveSheet.PrintOut ' prints the active sheet Application.ActivePrinter = STDprinter ' change back to standard printer End Sub You may not like the idea of installing something like PDFCreator on your systems, but you don't have much of a choice honestly - the PC needs to have a driver and need to be made aware of the printer. HTH "Karl" wrote: You can install a PDF printer driver such as PDF995 make the PDF driver driver the default printer in Windows "Carmen" wrote in message ... Hello, I've looked through the web to learn that if I want to convert Excel to and give it a specific name (automatically) through macro I should use ...printout PrintToFile:=True, PRtoFileName:="I/....xx.pdf" But there's an error accessing the created pdf. It's all due to PrintToFile functionality. If I change destination file name extension to .prn, then it works. However, when I double click on this .prn file it asks me to choose a program. It then converts it to adobe acrobat file. It's there a more direct way to create from excel to pdf and having file name as variable? My intention is to create batches of pdfs from excel and through macro emailing out to people. I want to skip the step of converting from .prn to .pdf (haven't figured how I would do it). Thanks, Carmen |
All times are GMT +1. The time now is 12:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com