Error 800A9C68 running VBS using task scheduler

shekkikim

New Member
Joined
Jul 22, 2014
Messages
19
Hello,

I keep getting this windows script host error.

Script: C\top 5 macro.vbs
Line: 5
Char: 1
Error: Unknown runtime error
Code: 800A9C68
Source: Microsoft VBScript runtime error

Code:
Dim xlApp
Dim xlBook
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open("S:\Operations\Daily Reports\Top 5\top five macro.xlsm", 0, True)
xlApp.Run "WeeklyReports"
xlBook.Close
xlApp.Quit
Set xlBook = Nothing
Set xlApp = Nothing

Any help or insight you guys can provide is greatly appreciated!

Thanks,

Shekk
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Try

Code:
xlApp.Run "'" & xlBook.Name & "'!WeeklyReports"
 
Upvote 0
whoops.

Edit: I just saw the same error Msg. It was hidden behind all my programs.
 
Last edited:
Upvote 0
Do you know what line fails?

If not, delete lines from the bottom until the failure does away.
 
Upvote 0
I believe the line that fails is:

Code:
Set xlBook = xlApp.Workbooks.Open("S:\Operations\Daily Reports\Top 5\top five macro.xlsm", 0, True)
 
Upvote 0
Does it work if you run it as a VBA macro in Excel?
 
Upvote 0
I just ran it through VBA and the error actually is at
Code:
[COLOR=#333333]xlApp.Run "'" & xlBook.Name & "'!WeeklyReports"[/COLOR]

Two things are happening now:

1. It says that the file is locked for editing by 'another user' (There is no other user)
2. Run-time error '440': Automation Error
 
Upvote 0
You don't already have the workbook open in the current Excel instance, do you?
 
Upvote 0
No I opened a blank excel file, put the code into it, and then ran it. There are no other instances of excel running. I honestly am pretty baffled with this. Would it help if I posted the code? It's a bit of a read and a bit messy.
 
Upvote 0

Forum statistics

Threads
1,215,026
Messages
6,122,738
Members
449,094
Latest member
dsharae57

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top