Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel/VBScript/Scheduled Task - will not run automated

Status
Not open for further replies.

PulsaMatt

IS-IT--Management
Apr 25, 2002
151
0
0
US
I currently have some daily reports I wrote that generate and email out Excel reports for orders and shipments. They work fine when run manually, but when I put them to run in a scheduled task they will not run. The script fails at these lines of code:

Code:
Set objXL = Wscript.createobject("Excel.Application")
set objXLbook = objXL.Workbooks.Add

Everything is properly dim'ed, but I am still keep getting 424 "Object Required" Errors.

I suspected a security issue as the user running the reports in the scheduled task is limited in its rights. But if I log on as that user and manually run the scripts it works fine, only in the scheduled task is this error coming up.

Any assistance would be greatly appreciated, I've tried most everything I could think of.



Matt Laski
Web & Systems Support
Pulsafeeder Inc.
 
Assuming you haven't found another issue, you might look at:


Office products are meant to run in the context of a currently logged on, interactive user. You aren't trying to run Excel server-side, but your scheduled run scenario may share many of the characteristics of such a situation.

They are not meant to be used as "batch" programs.

Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when run in this environment.


To a certain extent ADO and Jet can be used to create XLS workbooks as a reporting medium though you do not get much control over formatting. This is a much more reliable way to "report to Excel" though, especially from a scheduled script. One way to get a bit more control is to use ADO to "report into" a workbook that is empty but has a lot of the formatting, headings, coumn widths, etc. preset in a target worksheet or set of named ranges in a worksheet (or worksheets).

A much better alternative is to create reports of this type as HTML or RTF documents instead. Of course this doesn't always meet requirements.

You might look for 3rd party Excel manipulation components designed for server-side and batch use.


Hopefully you find that your problem here is something simple though. Otherwise you may be looking at a lot of rework of your current script.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top