Error 800A9C68 running VBS using task scheduler

David Montoya

New Member
Joined
Apr 25, 2018
Messages
49
Gentlemen,

I am running this code via task scheduler, and the workbook is closed when it runs. At the end of the process, it gives 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.
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hello David,

Try changing the line...
Code:
objExcel.Application.Quit

To just this...
Code:
objExcel.Quit
 
Upvote 0
Hi Leith,

I have done the suggested change, and now I am getting the following:

Run-time error '13':
Type mismatch

Thanks in advance for your assistance.
 
Upvote 0
Try adding:

Code:
objexcel.visible = True

to the start and see if there is an error message in Excel.
 
Upvote 0
Looks like you also posted the question over here: https://www.mrexcel.com/forum/excel...a9c68-running-vbs-using-task-scheduler-2.html

Please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread. Per forum rules, posts of a duplicate nature will typically be locked or deleted (rule 12 here: Forum Rules).
If you do not receive a response, you can "bump" it by replying to it again, though we advise you to wait 24 hours before doing and not to bump a thread more than once a day.

 
Upvote 0
Dear Joe4,


Yes, I did the posting back in April/18, and never received a reply to it. Then I thought that since I was posting to a 2014 posting, maybe was the reason to not getting any replies. Once I did a new post with the same question, I got a reply.


Pardon me if I have caused an infringement to the forum rules.


Best regards
 
Upvote 0
Yes, I did the posting back in April/18,
I think you mean last month (your post in that thread is from June 2018)!
Its rather odd that someone replied to that thread today, over a month since you posted the question, but just one day after you posted the question in a new thread (that is how I saw it)!
Not sure why they answered that thread and not your new one...
 
Upvote 0
Dear,

I have modified the VBS to include the visibility option, and all the Excel macros run as expected without any error.

I have noticed that when I included the visibility at the secondary line of the VBS script the error changed from Line 2 to Line 3:

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

From the test I have done, it appears to me that the trigger of the error is at my second line of my code above mentioned, but do not understand what it refers to "Char: 1"

Any other suggestion is appreciated.
 
Upvote 0
Perhaps try opening the workbook explicitly first:

Code:
Dim wb
Set objExcel = CreateObject("Excel.Application")
set wb = objexcel.workbooks.open("I:\Administration\Trade Compliance\Import Compliance\Trade Data\Daily Files\Master DB Daily Appends.xlsm")
objExcel.Run "'" & wb.name & "'!Module7.Trade_Data_Daily_Process"
objExcel.DisplayAlerts = False
wb.close false
objExcel.Quit
Set objExcel = Nothing
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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