Solved

Scheduled Task Excel Error

Posted on 2009-04-08
1
353 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

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

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

729 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