ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Print an excel file from command line or "cron" type command ??? (https://www.excelbanter.com/excel-programming/386094-print-excel-file-command-line-cron-type-command.html)

Chris Salcedo

Print an excel file from command line or "cron" type command ???
 
I need to print an excel file at 3:15 every day. I would like to be
able to "schedule" it like in a cron job...(windows of course...) I
cant find any way to directly print from a comman line like "excel.exe
"c:\myfile.xls" /p

Any Ideas ????


Deborah Digby

Print an excel file from command line or "cron" type command ???
 
If you can make sure that the Excel spreadsheet in questions is opened a
little before 3:15, then you can can put use Application.OnTime. eg

Private Sub Workbook_open()
application.onTime Date + TimeSerial(15,15,0), "PrintRoutine"
end sub

in a module:

Sub PrintRoutine()
dim sh as Object
for each sh in thisworkbook.Sheets
ws.printout
next sh
End Sub

Once the workbook is opened, it will do nothing until 3.15pm when it will
run PrintRoutine. It is worth saying that if you open this after 3.15pm it
will cause an error as the specified time is in the past.

"Chris Salcedo" wrote in message
oups.com...
I need to print an excel file at 3:15 every day. I would like to be
able to "schedule" it like in a cron job...(windows of course...) I
cant find any way to directly print from a comman line like "excel.exe
"c:\myfile.xls" /p

Any Ideas ????




JLGWhiz

Print an excel file from command line or "cron" type command ???
 
This if from the VBA Help file using the OnTime method:

Application.OnTime TimeValue("17:00:00"), "my_Procedure"

It starts the macro at 5 P.M. Maybe you could use this.

"Chris Salcedo" wrote:

I need to print an excel file at 3:15 every day. I would like to be
able to "schedule" it like in a cron job...(windows of course...) I
cant find any way to directly print from a comman line like "excel.exe
"c:\myfile.xls" /p

Any Ideas ????




All times are GMT +1. The time now is 11:41 AM.

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