ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Print a Spreadsheet w/Task Scheduler (https://www.excelbanter.com/excel-programming/335280-print-spreadsheet-w-task-scheduler.html)

LESLIE

Print a Spreadsheet w/Task Scheduler
 
I want to print a spreadsheet as a scheduled task.

Is there a DOS command to do this or can this be done with a Macro. I can
launch the spreadsheet with \Path\EXCEL.EXE <FileName and I could write a
Macro possibly to actually execute the print. Just brainstorming for ideas.

Any ideas from the experts?

Leslie

Dave Peterson

Print a Spreadsheet w/Task Scheduler
 
How about scheduling a script?

Save this text file as somename.VBS

Dim XLApp
Dim XLWkb
Set XLApp = CreateObject("Excel.Application")
xlapp.visible = true
xlapp.workbooks.open "c:\my documents\excel\book3.xls"
xlapp.activeworkbook.worksheets("sheet1").printout
xlapp.activeworkbook.close
xlapp.quit


Change the path and filename to what you need.

If you have macros, you'll want to set security to low--you don't want to be
prompted.


Leslie wrote:

I want to print a spreadsheet as a scheduled task.

Is there a DOS command to do this or can this be done with a Macro. I can
launch the spreadsheet with \Path\EXCEL.EXE <FileName and I could write a
Macro possibly to actually execute the print. Just brainstorming for ideas.

Any ideas from the experts?

Leslie


--

Dave Peterson

LESLIE

Print a Spreadsheet w/Task Scheduler
 
Dave,

This is exactly what I'm looking for! Using the VB script is a perfect
solution. I've since found MSFT used to have a /p command you used to be
able to put after the \path\Excel.exe <filename /p to print the files. They
removed this functionality a couple windows versions back and it simply
baffles me why they would remove such a fundamental functionality and force a
person to have to write scripts (which is OK, but a single command line
capability would be much easier).

In any case, Dave, THANK YOU!

Leslie

"Dave Peterson" wrote:

How about scheduling a script?

Save this text file as somename.VBS

Dim XLApp
Dim XLWkb
Set XLApp = CreateObject("Excel.Application")
xlapp.visible = true
xlapp.workbooks.open "c:\my documents\excel\book3.xls"
xlapp.activeworkbook.worksheets("sheet1").printout
xlapp.activeworkbook.close
xlapp.quit


Change the path and filename to what you need.

If you have macros, you'll want to set security to low--you don't want to be
prompted.


Leslie wrote:

I want to print a spreadsheet as a scheduled task.

Is there a DOS command to do this or can this be done with a Macro. I can
launch the spreadsheet with \Path\EXCEL.EXE <FileName and I could write a
Macro possibly to actually execute the print. Just brainstorming for ideas.

Any ideas from the experts?

Leslie


--

Dave Peterson



All times are GMT +1. The time now is 02:34 PM.

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