I have a macro in Excel that uses Selenium Basic Type Library to open chrome and automate a few web tasks in Chrome browser. I set up a VBS to run the macro and it runs smoothly manually when I double click the VBS.
Here's the flow:
Task Scheduler -> RunMacroUploadAsia.vbs to start WeekendNoRunAsia macro in WeeklyUpload.xlsm -> Complete WeekendNoRunAsia macro and start UploadPostAsia  macro to open chrome browser to perform a few web tasks.
When I use Windows Task Scheduler to run the VBS script to run the Excel macro on a schedule, the
"Run time error 429, ActiveX component can't create object"
error comes up on the Excel window. When I debug the macro it gets stuck in this line of code in the UploadPostAsia macro:
Set D = New ChromeDriver
Why does the VBS runs fine manually and not on Task Scheduler?
Here's the set up of my situation. The VBA is written in Excel 2007 and I have Selenium Type Library installed (SeleniumBasic v2.0.9.0). My laptop is run on Windows 7 Home Basic 64 bit and my Chrome browser v71.0.3578.98.
In Task Scheduler Under Actions tab, I have the following:
"C:\Users\SKhany\Google Drive\myexample\mystuff tasks\RunMacroUploadAsia.vbs"Here's the RunMacroUploadAsia.vbs script:
Option Explicit On Error Resume Next ExcelMacroExample Sub ExcelMacroExample() Dim xlApp Dim xlBook Set xlApp = CreateObject("Excel.Application") xlApp.Visible = True Set xlBook = xlApp.Workbooks.Open("C:\Users\SKhany\Google Drive\myexample\mystuff tasks\WeekdayUpload.xlsm", 0, True) xlApp.Run "WeekendNoRunAsia" xlApp.Quit Set xlBook = Nothing Set xlApp = Nothing End SubThen the macro WeekendNoRunAsia will run follows by UploadPostAsia (code is as below) and then Task Scheduler will stuck at
Set D = New ChromeDriver
The workflow works if I don't use Task Scheduler and I tried changing the code to Set D = New Selenium.Chromedriver and still have the same error.  I need to run this workflows every weekday and will really like to fix the issue with Task Scheduler or if there's any other way to schedule the VBS is welcome. Appreciate any help you on this. 
Public Sub UploadPostAsia()
    Dim ws As Worksheet
    Dim D As WebDriver
    Dim i As Integer
    Set ws = ThisWorkbook.Worksheets("Data")
    Set D = New ChromeDriver
    Const URL = "https://www.myexample.com/login/"
    'To login to website
    With D
        .Start "Chrome"
        .Window.Maximize
        .Get URL
        .FindElementById("user_login").SendKeys(ws.Cells(2, 1)).Click
        .FindElementById("user_pass").SendKeys(ws.Cells(2, 2)).Click
        .FindElementByName("submit").Click
    End With
   'Perform some web tasks
End Sub