Faulting module name: KERNELBASE.dll when running EXCEL via VBScript in windows server 2019


Im trying to execute an Excel Macro via VBScript that run every 2 minutes via Windows Scheduler. For this macro work, I have installed an AddIn for Excel and for this AddIn work a program need to be open. Currently, Im running this on a Windows Server 2019 on Amazon EC2, while Im logged via RDP connection everything runs fine, but while Im disconnect script executes every 2 minutes, the program is opened but the excel always fails and show this error:

Faulting application name: EXCEL.EXE, version: 16.0.13426.20404, time stamp: 0x5fdea4e7
Faulting module name: KERNELBASE.dll, version: 10.0.17763.1613, time stamp: 0xa4105fac
Exception code: 0xe0434352
Fault offset: 0x001225f2
Faulting process id: 0xe3c
Faulting application start time: 0x01d6e5f4ca9ab8c6
Faulting application path: C:\Program Files (x86)\Microsoft Office\Root\Office16\EXCEL.EXE
Faulting module path: C:\Windows\System32\KERNELBASE.dll
Report Id: afc9ea7a-f38d-425b-addb-7781ad2b4e64
Faulting package full name: 
Faulting package-relative application ID: 

I was thinking the AddIn was causing the error, but i tried some things like uninstall AddIn after run Macro and before quit Excel, but the error still persist.

Set WshShell = WScript.CreateObject("WScript.Shell")

exeName = "C:\Program Files (x86)\BroadcastAgro\bcsys32.exe"

WScript.Sleep 5000
WshShell.SendKeys "{ENTER}"
WScript.Sleep 15000

On Error Resume Next
'Input Excel File's Full Path
    ExcelFilePath = "C:\Users\Administrator\Desktop\Pasta2.xlsm"

'Input Module/Macro name within the Excel File
    MacroPath = "Planilha1.CommandButton1_Click"

'Create an instance of Excel
    Set ExcelApp = CreateObject("Excel.Application")

'Do you want this Excel instance to be visible?
    ExcelApp.Visible = False

'Prevent any App Launch Alerts (ie Update External Links)
    ExcelApp.DisplayAlerts = False

'Open Excel File
    Set wb = ExcelApp.Workbooks.Open(ExcelFilePath)

    ExcelApp.RegisterXLL "C:\Program Files (x86)\BroadcastAgro\Broadcast.AddIn64.xll"
    ExcelApp.AddIns("Broadcast+").Installed = False
    ExcelApp.AddIns("Broadcast+").Installed = True 
    ExcelApp.Cells(3, 2).Calculate
    WScript.Sleep 30000

'Execute Macro Code
    ExcelApp.Run MacroPath
'Reset Display Alerts Before Closing
    ExcelApp.DisplayAlerts = False
    ExcelApp.AddIns("Broadcast+").Installed = False
'Close Excel File
    wb.Close False

'End instance of Excel


I really tried lot of things but still only work while Im in an active RDP connection

asked on Stack Overflow Jan 8, 2021 by Vinicius Batista • edited Jan 11, 2021 by Pᴇʜ

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0