ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ExecuteExel4 Macro parameters.. (https://www.excelbanter.com/excel-programming/406927-executeexel4-macro-parameters.html)

TKoel

ExecuteExel4 Macro parameters..
 
I'm trying to get VBA code to print a worksheet in Excel to a PDF file and
automatically enter the name of the file to be saved. I've seen the
following code - Application.ActivePrinter = "Adobe PDF on Ne10:"
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,""Adobe PDF on Ne10:"",,TRUE,,FALSE)"

I'm guessing that all those comas refer to options which may include a file
name.
If so, what is the syntax for adding a string variable in there which would
send the name. Also, I've noticed that the "Ne" designation for my printers
changes from time to time. Is there a way to trap that info so my code can
always be accurate?
Thanks.

Jim Cone

ExecuteExel4 Macro parameters..
 

My xl4 function reference book lists these options (in order) for the Print command...

range_num (1 prints all pages, 2 prints the specified pages)
from
to
copies
draft
preview
print_what (1 is sheet only, 2 is notes only, 3 is sheet and then notes)
color
feed
quality
vquality

I see nothing that allows a file to be specified. But that doesn't mean it won't work.

Also, it says... Printer.Setup(name of printer) to specify a printer.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)


"TKoel" wrote in message
I'm trying to get VBA code to print a worksheet in Excel to a PDF file and
automatically enter the name of the file to be saved. I've seen the
following code - Application.ActivePrinter = "Adobe PDF on Ne10:"
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,""Adobe PDF on Ne10:"",,TRUE,,FALSE)"

I'm guessing that all those comas refer to options which may include a file
name.
If so, what is the syntax for adding a string variable in there which would
send the name. Also, I've noticed that the "Ne" designation for my printers
changes from time to time. Is there a way to trap that info so my code can
always be accurate?
Thanks.

TKoel

ExecuteExel4 Macro parameters..
 
Thanks a lot.
That's good info to have.
I'll keep looking for tips on the file name, print que etc..


"Jim Cone" wrote:


My xl4 function reference book lists these options (in order) for the Print command...

range_num (1 prints all pages, 2 prints the specified pages)
from
to
copies
draft
preview
print_what (1 is sheet only, 2 is notes only, 3 is sheet and then notes)
color
feed
quality
vquality

I see nothing that allows a file to be specified. But that doesn't mean it won't work.

Also, it says... Printer.Setup(name of printer) to specify a printer.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)


"TKoel" wrote in message
I'm trying to get VBA code to print a worksheet in Excel to a PDF file and
automatically enter the name of the file to be saved. I've seen the
following code - Application.ActivePrinter = "Adobe PDF on Ne10:"
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,""Adobe PDF on Ne10:"",,TRUE,,FALSE)"

I'm guessing that all those comas refer to options which may include a file
name.
If so, what is the syntax for adding a string variable in there which would
send the name. Also, I've noticed that the "Ne" designation for my printers
changes from time to time. Is there a way to trap that info so my code can
always be accurate?
Thanks.



All times are GMT +1. The time now is 12:23 PM.

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