Solved

Scheduled Task Excel Error

Posted on 2009-04-08
1
340 Views
Last Modified: 2012-05-06
I have a scheduled task that runs on a Windows Server 2003 machine that runs a .vbs job.  This  job has been running successfully for 6 months.  Last weekend the job started failing.  I am unaware of any changes on the server.  Though the job is not producing the desired results, the Scheduled Task indicates it completed successfully. If the job is run from a command line it is successful.   Googling around I found an article that suggested running the job from a batch file and collecting the results in a log file.  Doing so, the job produced this error:

D:\SARMaGIC\ReportScript\WeeklyStaffSARMetricsExcel.vbs(77, 1) Microsoft Office Excel: Unable to get the Add property of the Workbooks class

The applicable code is below.  I don't understand why this worked for so long and is failing now, only in Scheduled Tasks.  I've attempted to run it from cscript to no avail.  Any help will be greatly appreciated.
76 Set objExcel = CreateObject("Excel.Application")

77 Set objWB = objExcel.Workbooks.Add

78 Set objSheet = objWB.Sheets("Sheet3")

79 objSheet.Delete

80 Set objSheet = objWB.Sheets("Sheet2")

81 objSheet.Delete

82 Set objSheet = objWB.Sheets("Sheet1") 

83 objsheet.name = "Data"

Open in new window

0
Comment
Question by:robtroller
1 Comment
 

Accepted Solution

by:
robtroller earned 0 total points
Comment Utility
This issue turned out to be several hung sessions of Excel resident on the machine.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now