?
Solved

Scheduled Task Excel Error

Posted on 2009-04-08
1
Medium Priority
?
355 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
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 two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

741 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