ManojK Posted September 25, 2018 Posted September 25, 2018 Hi I have little experience in Auto IT tool. we have created code to read data from excel and perform actions in windows application. while opening excel work book i am getting error pop up as ""<<fileName>>.exe has stopped working" Windows is collecting more information about the problem. this might take several minutes..." We are encountering this pop-up randomly 4 th or 5th test case execution. attaching the code and error message. $oExcel = _Excel_Open(False, False, False, True, False) $oWorkbook = _Excel_BookOpen($oExcel, $TestDataDirectory,True,False) --------Error causing step. $aResult = _Excel_RangeRead($oWorkbook, $arrTestCaseFilePath[2], Default,1,default) Based on few comments in forums i have given below command with "Y" and "N" options. it's working in few system and it's not working in few systems(still in observation stage). #AutoIt3Wrapper_UseX64=n please help me in this issue
Moderators JLogan3o13 Posted September 25, 2018 Moderators Posted September 25, 2018 How large is the excel workbook you're trying to open, and what macros does it have configured on open? Nothing in the code you've shared would cause the error you're seeing. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
ManojK Posted September 25, 2018 Author Posted September 25, 2018 Hi While executing below step we are getting error pop-ups provided in screenshot. $oWorkbook = _Excel_BookOpen($oExcel, $TestDataDirectory,True,False) --------Error causing step. workbook size approx 400 kb. having macros to create new sheet when we click on "New Button". this issue we are encountering randomly on most of machines but not on all machines
Moderators JLogan3o13 Posted September 25, 2018 Moderators Posted September 25, 2018 Is TerminalKeywordExecution.exe the name of your script? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
KickStarter15 Posted September 26, 2018 Posted September 26, 2018 @ManojK, Does the issued PC has Excel installed? same of what version you used when you have in you own computer? I've encountered the same issue before and cause of error is due to excel installed is only a viewer and some has no excel at all being installed. 19 hours ago, JLogan3o13 said: How large is the excel workbook you're trying to open, and what macros does it have configured on open? Also, please answer above question from JLogan3o13. Might be one of the cause. Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.
water Posted September 26, 2018 Posted September 26, 2018 Add error checking to your script and remove some parameters from the function calls so you get any Excel error message. #include <Excel.au3> $oExcel = _Excel_Open() If @error Then Exit Msgbox(16, "Error!", "Error opening Excel. @error=" & @error & ", @extended=" & @extended) $oWorkbook = _Excel_BookOpen($oExcel, $TestDataDirectory,True) --------Error causing step. If @error Then Exit Msgbox(16, "Error!", "Error opening Workbook. @error=" & @error & ", @extended=" & @extended) $aResult = _Excel_RangeRead($oWorkbook, $arrTestCaseFilePath[2], Default,1,default) If @error Then Exit Msgbox(16, "Error!", "Error reading Workbook. @error=" & @error & ", @extended=" & @extended) 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
ManojK Posted September 28, 2018 Author Posted September 28, 2018 HI already i have placed below statement. while executing _Excel_BookOpen statement we are getting above popup and even below(Exception) statement is not getting executed. looks like tool execution is stopping at this point. We are not encountering this issue in all systems. randomly 2-3 systems few times we are getting this pop-up. we have developed nearly 50 test cases with this tool. one failure halting entire execution due to this issues during night time. $oWorkbook = _Excel_BookOpen($oExcel, $TestDataDirectory,True,False) If @error Then writeToFile($ExecutionLog,"ErrorBlockofOpenWorkBook"& _NowDate() &" "& _NowTime(5)&@CRLF) EndIf
Juvigy Posted September 28, 2018 Posted September 28, 2018 Have you checked your firewall or AV software? Often it blocks AutoIt execution and sometimes you see such errors.
ManojK Posted September 28, 2018 Author Posted September 28, 2018 (edited) we have excluded our AutoIT installation folder (C:\Program Files\AutoIT) and our Automation folder from AV Software. do we need to exclude anything else Also i would like to know what is maximum Excel file size does Auto IT supports. Edited September 28, 2018 by ManojK
FrancescoDiMuro Posted September 28, 2018 Posted September 28, 2018 22 minutes ago, ManojK said: Also i would like to know what is maximum Excel file size does Auto IT supports. I think that it's the same for VBA https://support.office.com/en-us/article/excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3 Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
jdelaney Posted September 28, 2018 Posted September 28, 2018 Just as a pure debugging exercise, you can convert and run your script as a vbs script. I'd also google the com method and see what the Microsoft community has to say about it. tldr: sounds like a Microsoft problem and not an autoit problem IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
ManojK Posted October 17, 2018 Author Posted October 17, 2018 Hi all, after converting from .xlsm to .xlsx we did not encountered this pop-up past 4 day's still we are monitoring this issue. we also encountering another issue as "Variable must be of type "Object". while opening Work book (while executing below step). $oWorkbook = _Excel_BookOpen($oExcel, $TestDataDirectory,True,False) I am attaching the total code which we are performing on Excel to read data. please suggest me if any solution is available for this issue. this issue also we are not encountering Every time. Encountering it once in 6-7 test runs. Global $oExcel="" Global $oWorkbook="" Global $aResult="" $oExcel = _Excel_Open(False, False, False, True, False) $oWorkbook = _Excel_BookOpen($oExcel, $TestDataDirectory,True,False)---- Hitting with error at this step. $aResult = _Excel_RangeRead($oWorkbook, $arrTestCaseFilePath[2], Default,1,default) _Excel_BookClose($oWorkbook, False) _Excel_Close($oExcel,False,True) Iue while opening work book. attaching the screenshot below.
Juvigy Posted October 17, 2018 Posted October 17, 2018 Put this in a loop and test with IsObject - $oExcel = _Excel_Open(False, False, False, True, False) This way you will ensure that it always opens. 5 repetition FOR loop with 1 second sleep between iteration and you wont see this error anymore.
ManojK Posted October 17, 2018 Author Posted October 17, 2018 Hi Juvigy, I have already included below code. observed excel object is getting created every time even when we encounter above error. If Not IsObj($oExcel) Then _Excel_Close($oExcel,False,True) writeToFile($ExecutionLog,"Opening Excel Object in Object checking block" & _NowDate() &" "& _NowTime(5)&@CRLF) $oExcel = _Excel_Open(False, False, False, True, False) ElseIf IsObj($oExcel) Then writeToFile($ExecutionLog,"ExcelObject is Exist" & _NowDate() &" "& _NowTime(5)&@CRLF) Else writeToFile($ExecutionLog,"ElseBlockGotExecutedwhileValidatingExcelObject" & _NowDate() &" "& _NowTime(5)&@CRLF) EndIf Below steps are from our userdefined log file. It says Excel object is exist by using above code. Test CaseID is: , Keyword is: ,Status pass, On 10/16/2018 18:51:50 Test CaseID is: , Keyword is: ,Status pass, On 10/16/2018 18:51:52 Exception descriptionC:\FLTNightlyExecution\Selenium_IDS_FW\TerminalAutomation\TestCaseFiles\VertexAnalysisTerminal.xlsx10/16/2018 18:51:54 ExcelObject is Exist10/16/2018 18:51:56 Opening ExcelWorkBook:C:\FLTNightlyExecution\Selenium_IDS_FW\TerminalAutomation\TestCaseFiles\VertexAnalysisTerminal.xlsx10/16/2018 18:51:56
water Posted October 17, 2018 Posted October 17, 2018 This will always return an error as the object you use in _Excel_Close does never exist according to the check in line 1. If Not IsObj($oExcel) Then _Excel_Close($oExcel,False,True) 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
ManojK Posted October 18, 2018 Author Posted October 18, 2018 HI Water I will remove these line. i have added this line as part of recovery. when previous test case fail to open Work book we are encountering above errors and it's leaving the "Excel.exe" locks. To close those Excel process i added lines to forcefully kill from task manager and addition to this i added mentioned steps. as per my logs i am not encountering issue at this step. while opening work book we are getting this message and tool execution is getting stop at this point. we added above mentioned steps after i encounter this issue.
water Posted October 18, 2018 Posted October 18, 2018 Sometimes such problems are caused by poorly written Excel Add-Ins. Can you deactivate them and try again? 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
Juvigy Posted October 19, 2018 Posted October 19, 2018 Why dont you post your full code? Judging by your IF mess above I think your code is poorly written and that is why you get issues.
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