Hi,
I am trying to add an error handling functionality on my vbscript, but it doesnt seem working. My vbscript simply invokes an Excel Macro but there are some instance that the macro will produce a runtime error and when it happens, a message box prompts saying a Runtime error and then an "EXCEL.EXE" is running at my Windows Task Manager. I wanted to get rid of those two (EXCEL.EXE at task manager and Runtime error prompt message). How can I do that?
My sample code is as follows and I am executing this script using the "cscript" function:
Thanks.
I am trying to add an error handling functionality on my vbscript, but it doesnt seem working. My vbscript simply invokes an Excel Macro but there are some instance that the macro will produce a runtime error and when it happens, a message box prompts saying a Runtime error and then an "EXCEL.EXE" is running at my Windows Task Manager. I wanted to get rid of those two (EXCEL.EXE at task manager and Runtime error prompt message). How can I do that?
My sample code is as follows and I am executing this script using the "cscript" function:
Code:
Dim ArgObj, var1, var2, var3
Set ArgObj = WScript.Arguments
On Error Goto 0
'First parameter target file
var1 = ArgObj(0)
'Second parameter validation file
var2 = ArgObj(1)
'Third parameter macro
var3 = ArgObj(2)
Set objExcel1 = CreateObject("Excel.Application")
Set objWorkbook1 = objExcel1.Workbooks.Open(var1)
Set objWorkbook2 = objExcel1.Workbooks.Open(var2)
objExcel1.Run (var3)
Set objExcel1 = Nothing
set ArgObj = Nothing
Comment