Udit Posted June 3, 2015 Share Posted June 3, 2015 While writing to an excel sheet i received the following error -"Error getting an object of excel result file. Error code :800401EA"Auto IT version is 3.3.10.0I am using MS office 2013Code is -Func SaveResult($Status)$sFile1 = $scriptpath & "\temp.txt"Local $hFile1 = FileOpen($sFile1, 0) ; Read file containing TC id and Worksheet Name; Check if file opened for writing OKIf $hFile1 = -1 ThenMsgBox(16, "SaveResult func error", "Unable to open Temp file. Press OK to exit", 10)ExitEndIfLocal $Id = FileReadLine($hFile1, 1) ; Retrieve the Test case id from fileLocal $ExcelCell = FileReadLine($hFile1, 3) ; Retrieve the Cell no of currently running test caseLocal $path2 = RegRead("HKEY_CURRENT_USER\Environment", "Result Path")If Not FileExists($path2) ThenMsgBox(16, "SaveResult func error", "Can't save result, because you didn't create the Excel file " & $path2, 10)ExitEndIf$oExcelSave = ObjGet($path2, "Excel.Application") ; Get an Excel Object from an existing filename;~ $oExcelSave = ObjGet("", "Excel.Application") ; Get an Excel Object from an existing filenameIf @error ThenMsgBox(16, "SaveResult func error", "Error Getting an Object of Excel Result file. Error code: " & Hex(@error, 8), 10)ExitEndIf_ExcelWriteCell($oExcelSave, $Status, Int($ExcelCell), 7)If $Status = "Fail" Then ; If Test Case is failed_ScreenCapture_Capture($scriptpath & "\Screenshots\" & $Id & " " & @MDAY & '_' & @MON & '_' & @YEAR & ".jpg") ; Capture full screen_ExcelWriteCell($oExcelSave, $scriptpath & "\Screenshots\" & $Id & " " & @MDAY & '_' & @MON & '_' & @YEAR & ".jpg", Int($ExcelCell), 8)EndIf_ExcelWriteCell($oExcelSave, @MDAY & '-' & @MON & '-' & @YEAR & ' ' & @HOUR & ':' & @MIN & ':' & @SEC, Int($ExcelCell), 9) ; Write Date and Time in Result FileFileClose($hFile1)This code was working fine on AutoIT version 3.3.8.1 Link to comment Share on other sites More sharing options...
water Posted June 3, 2015 Share Posted June 3, 2015 I think it should be$oExcelSave = ObjGet($path2) ; Get an Excel Object from an existing filename Udit 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted June 3, 2015 Share Posted June 3, 2015 BTW: Why don't you upgrade AutoIt to 3.3.12.0 and you get a fully rewritten, faster and better Excel UDF My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Udit Posted June 4, 2015 Author Share Posted June 4, 2015 I think it should be$oExcelSave = ObjGet($path2) ; Get an Excel Object from an existing filename Thank you for your help, this worked fine for my script.I tried using V3.3.12.0 but the inbuilt keywords for v3.3.8.1 are not compatible with that in v3.3.12.0. I will have to modify all the changes first, to move it. Thanks again for the help and suggestion. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now