com - Unable to access Excel's Application.ComAddIns property if there are no AddIns installed -
This code displays the number of COM-AddIns currently installed in Excel that is omitted for Windows Scripting Host.
When no COM-AddIns are installed, it works fine. I believe it should be "0", but instead it raises an exception (code 800A03EC) does anyone know?
set test.vbs objExcel = CreateObject ("Excel.Application") WScript.Echo objExcel.ComAddIns.Count
Looks like a bug in Excel. Perhaps you have to deal with VB's error handling to work around it.
restart the error on the next WScript.Echo objExcel.ComAddIns.Count if error and Err.Number = 1004 Then WScript.Echo "There is no add-ins" If the error gets over Then <0>
Comments
Post a Comment