Solved

Scheduled Task Excel Error

Posted on 2009-04-08
1
346 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
ID: 24095887
This issue turned out to be several hung sessions of Excel resident on the machine.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
how to do this Excel search box Soundex Search 6 28
Set WorkSheet  not Working 9 44
List Box Entries Excel 2010 5 32
Excel 2007 VB Code for GCF 7 18
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.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
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 using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

821 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