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

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
It's never getting to the macro code, so that isn't the problem du jour, right?
 
Upvote 0
It's funny that you say that, because it runs the macro for some reason. I get these errors after everything finishes.
 
Upvote 0
Shekkikim did you get a fix for this as I am having the exact same issue with my vbscript. I believe we got it from the same source since ours are practically identical. I get the same error and it points me to where the xlApp.Run line is. It gets to the macro and runs it completely. Can someone help please?
 
Upvote 0
Hey Cal,

I did figure something out. Hopefully this helps you out. However, most likely it's due to the macro that you're trying to run. Probably something in there is conflicting with your vbs.

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)
xlBook.Saved = True
xlBook.Close
xlApp.Quit
Set xlBook = Nothing
Set xlApp = Nothing
 
Upvote 0
I found the fix to it! it was the last line of code that I had in my macro where it was activeworkbook.close. I commented that line of code out and it didn't create the error message anymore. Thanks to you and also shg!
 
Upvote 0
Gentlemen, I have a similar problem as the above mentioned, and need some help. I am running it via task scheduler, and the workbook is close. At the end of the process give me the following error; however, all the expected processes are perfect. I have also run the macro manually, and it works as expected. I suspect the VBS code has something wrong:

Script: "Location path of the VBS script"
Line: 2
Char: 1
Error: Unknown runtime error
Code: 800A9C68
Source: Microsoft VBSScript runtime error

The following is the code:
Code:
Set objExcel = CreateObject("Excel.Application")
objExcel.Application.Run "'I:\Administration\Trade Compliance\Import Compliance\Trade Data\Daily Files\Master DB Daily Appends.xlsm'!Module7.Trade_Data_Daily_Process"
objExcel.DisplayAlerts = False
objExcel.Application.Quit
Set objExcel = Nothing

Thanks in advance for your assistance.
 
Upvote 0
I was having the problem and based on this thread, got the error resolved. I am going to include a bit more detail than just the issue at hand to help others research what they may be doing.

I use Task Scheduler to run C:\script.vbs with blank Arguments and Start In fields.

script.vbs has:

Dim objExcel
Set objExcel =CreateObject("Excel.Application")
objExcel.Workbooks.Open "C:\Book1.xlsm"
objExcel.Run "Main_"
objExcel.ActiveWorkbook.Close
objExcel.Quit
Set objExcel = Nothing

Book1.xlsm has:
Sub Main_
Application.DisplayAlerts = False
Range("A1").Value = Time
ActiveWorkbook.Save
End Sub

I originally had ActiveWorkbook.Close within the macro (Book1.xlsm) but when I moved it to script.vbs the error went away.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,335
Members
452,636
Latest member
laura12345

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