Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Error 800A9C68 running VBS using task scheduler

  1. #1
    New Member
    Join Date
    Apr 2018
    Posts
    23
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Error 800A9C68 running VBS using task scheduler

    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.

  2. #2
    Board Regular Leith Ross's Avatar
    Join Date
    Mar 2008
    Location
    San Francisco, CA
    Posts
    1,719
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Error 800A9C68 running VBS using task scheduler

    Hello David,

    Try changing the line...
    Code:
    objExcel.Application.Quit
    To just this...
    Code:
    objExcel.Quit
    Sincerely,
    Leith Ross

  3. #3
    New Member
    Join Date
    Apr 2018
    Posts
    23
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Error 800A9C68 running VBS using task scheduler

    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.

  4. #4
    MrExcel MVP
    Moderator
    RoryA's Avatar
    Join Date
    May 2008
    Location
    UK
    Posts
    32,171
    Post Thanks / Like
    Mentioned
    24 Post(s)
    Tagged
    3 Thread(s)

    Default Re: Error 800A9C68 running VBS using task scheduler

    Try adding:

    Code:
    objexcel.visible = True
    to the start and see if there is an error message in Excel.

  5. #5
    MrExcel MVP
    Moderator
    Joe4's Avatar
    Join Date
    Aug 2002
    Posts
    46,664
    Post Thanks / Like
    Mentioned
    36 Post(s)
    Tagged
    6 Thread(s)

    Default Re: Error 800A9C68 running VBS using task scheduler

    Looks like you also posted the question over here: https://www.mrexcel.com/forum/excel-...heduler-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.

    TIPS FOR FINDING EXCEL SOLUTIONS
    1. Use the built-in Help that comes with Excel/Access
    2. Use the Search functionality on this board
    3. A lot of VBA code can be acquired by using the Macro Recorder.

    "Give a man a fish, feed him for a day. Teach a man to fish, feed him for life!"

  6. #6
    New Member
    Join Date
    Apr 2018
    Posts
    23
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Error 800A9C68 running VBS using task scheduler

    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

  7. #7
    MrExcel MVP
    Moderator
    Joe4's Avatar
    Join Date
    Aug 2002
    Posts
    46,664
    Post Thanks / Like
    Mentioned
    36 Post(s)
    Tagged
    6 Thread(s)

    Default Re: Error 800A9C68 running VBS using task scheduler

    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...
    TIPS FOR FINDING EXCEL SOLUTIONS
    1. Use the built-in Help that comes with Excel/Access
    2. Use the Search functionality on this board
    3. A lot of VBA code can be acquired by using the Macro Recorder.

    "Give a man a fish, feed him for a day. Teach a man to fish, feed him for life!"

  8. #8
    New Member
    Join Date
    Apr 2018
    Posts
    23
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Error 800A9C68 running VBS using task scheduler

    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.

  9. #9
    MrExcel MVP
    Moderator
    RoryA's Avatar
    Join Date
    May 2008
    Location
    UK
    Posts
    32,171
    Post Thanks / Like
    Mentioned
    24 Post(s)
    Tagged
    3 Thread(s)

    Default Re: Error 800A9C68 running VBS using task scheduler

    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

  10. #10
    New Member
    Join Date
    Apr 2018
    Posts
    23
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Error 800A9C68 running VBS using task scheduler

    Now the error displays "Line: 4" instead of "Line: 2"

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •