Reply to _Excel_BookOpen issue

By water,
Because the problem is not caused by a missing COM error but by an AutoIt bug. In the first post the problem is caused when accessing a property of an object that doesn't exist. Add the following function to your script and replace _Excel_BookOpen with _Excel_BookOpenEX. Func _Excel_BookOpenEX($oExcel, $sFilePath, $bReadOnly = Default, $bVisible = Default, $sPassword = Default, $sWritePassword = Default, $bUpdateLinks = Default)     ; Error handler, automatic cleanup at end of function     Local $oError = ObjEvent("AutoIt.Error", "__Excel_COMErrFunc")     #forceref $oError     If Not IsObj($oExcel) Or ObjName($oExcel, 1) <> "_Application" Then Return SetError(1, @error, 0)     If Not FileExists($sFilePath) Then Return SetError(2, 0, 0)     If $bReadOnly = Default Then $bReadOnly = False     If $bVisible = Default Then $bVisible = True     Local $oWorkbook = $oExcel.Workbooks.Open($sFilePath, $bUpdateLinks, $bReadOnly, Default, $sPassword, $sWritePassword)     If @error Then Return SetError(3, @error, 0)     Local $oWindow = $oExcel.Windows($oWorkbook.Name) ; <== Modified If IsObj($oWindow) Then $oWindow.Visible = $bVisible ; <== Modified     ; If a read-write workbook was opened read-only then set @extended = 1     If $bReadOnly = False And $oWorkbook.Readonly = True Then Return SetError(0, 1, $oWorkbook)     Return $oWorkbook EndFunc   ;==>_Excel_BookOpen