Solved

Scheduled Task Excel Error

Posted on 2009-04-08
1
347 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
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…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

737 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