Mayur Posted February 19, 2010 Share Posted February 19, 2010 Hi All, I need to read multiple data from excel sheet so for that purpose i open Excel work book using _ExcelBookOpen Then i used _ExcelSheetActivate Function & then _ExcelReadCell & _ExcelBookClose function. But after execution i found that there are number of EXCEL.exe Processes are running in Task Manager so it slower's the execution time Some times machine gets hang. Does any one have solution for this problem. Thanks in Advance, Mayur Link to comment Share on other sites More sharing options...
kaotkbliss Posted February 19, 2010 Share Posted February 19, 2010 Maybe at the end of your session you can use ProcessClose ( "process") that kills the exe from the taskman If, after 1 session you have multiple instances then you can do a loop to check $check=ProcessExists("EXCEL.exe") while $check<>0 if ProcessExists("EXCEL.exe") then ProcessClose("EXCEL.exe") sleep(10) endif $check=ProcessExists("EXCEL.exe") wend 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
Juvigy Posted February 19, 2010 Share Posted February 19, 2010 _ExcelBookClose closes the opened workbook but leaves the application running. Add in your script: $oExcel.Application.Quit Where oExcel is the object returned by _ExcelBookOpen Link to comment Share on other sites More sharing options...
broliukaz Posted January 31, 2014 Share Posted January 31, 2014 Hi, I have the same problem, and does not work any of those functions: _ExcelBookClose $oExcel.Application.Quit I am using MS Excel 2013. I can not use the ProcessClose(excel.exe), becouse there is open more excel documents, whitch is needed and they can not be closed. what I can do? Link to comment Share on other sites More sharing options...
water Posted January 31, 2014 Share Posted January 31, 2014 You need to release the reference to the Excel object in AutoIt too: $oExcel.Application.Quit $oExcel = 0 My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
broliukaz Posted January 31, 2014 Share Posted January 31, 2014 You need to release the reference to the Excel object in AutoIt too: $oExcel.Application.Quit $oExcel = 0 I try this, but no luck Maybe there have to be some order to use this lines? or order does not mater? i try: $oxlsServices.ActiveWorkBook.Close _ExcelBookClose($oxlsServices,0,0) $oxlsServices.Application.Quit $oxlsServices = 0 FileClose($xlsServices) no luck Link to comment Share on other sites More sharing options...
water Posted January 31, 2014 Share Posted January 31, 2014 We need more information: Which Autoit version do you run? Do you get any error messages? What's the value of @error after each statement? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
broliukaz Posted January 31, 2014 Share Posted January 31, 2014 We need more information: Which Autoit version do you run? Do you get any error messages? What's the value of @error after each statement? AutoIt Version 3.3.6 no error messages at all @error is = 0 Link to comment Share on other sites More sharing options...
water Posted January 31, 2014 Share Posted January 31, 2014 3.3.6 is nearly 4 years old. Would you mind to upgrade to 3.3.10.2 or at least 3.3.8.1? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
broliukaz Posted February 3, 2014 Share Posted February 3, 2014 Oh, I'am sorry, this is SciTE-Lite version 3.3.6 AutoIT version is 3.3.10.2 Link to comment Share on other sites More sharing options...
water Posted February 3, 2014 Share Posted February 3, 2014 Could you please post your script or a reproducer script? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
broliukaz Posted February 3, 2014 Share Posted February 3, 2014 expandcollapse popupFunc SearchForService() ;~ ------------------------ Search for service --------------------------------- Local $oxlsServices = _ExcelBookOpen($xlsServices, $fVisible) $XlsArray = _ExcelReadSheetToArray($oxlsServices) ;Using Default Parameters $readSN = String($readSN) $readSN = StringStripWS($readSN,8) Local $snPos = _ArraySearch($XlsArray, $readSN, 0, 0, 0, 0, 1) ;~ _ArrayDisplay($XlsArray, "Array using Default Parameters") If $snPos < 0 Then Local $ArrayError If @error = 1 Then $ArrayError = "Array is not an array" If @error = 2 Then $ArrayError = "Array is not a 1 or 2 dimensional array" If @error = 3 Then $ArrayError = "Array is empty" If @error = 4 Then $ArrayError = "$iStart is greater than $iEnd" If @error = 6 Then $ArrayError = "Value was not found in array" If @error = 7 Then $ArrayError = "Array has too many dimensions" ;~ MsgBox(0, "Not Found", $readSN & ' was not found. $snPos: ' & $snPos & " Error: " & $ArrayError) GUICtrlSetData($ServiceBox,"SN: " & $readSN & ' - no service found in the "Warranty_services.xls" file') GUICtrlSetBkColor($ServiceBox,0xEEEEEE) GUICtrlSetFont($ServiceBox, 9, 700) ; text bold Else GUICtrlSetData($ServiceBox,"SN:"& $readSN & " has a service: " & @CRLF& _ $XlsArray[$snPos][4] &@CRLF & _ "PN: "& $XlsArray[$snPos][2] & @CRLF& _ "Warranty from: "& $XlsArray[$snPos][8] & @CRLF & _ "Warranty to: " & $XlsArray[$snPos][9] & @CRLF & _ "RF LOT NR: "& $XlsArray[$snPos][5] & @CRLF & _ "Project name: "& $XlsArray[$snPos][6] & @CRLF& _ "Contract Nr: "& $XlsArray[$snPos][7] & @CRLF) ;~ MsgBox(0, "Found", $readSN & " was found in the array at position " & $snPos) GUICtrlSetBkColor($ServiceBox, 0xFF9999) ;Background color red GUICtrlSetFont($ServiceBox, 9, 700) ; text bold EndIf _ExcelBookClose($oxlsServices,0,0) MsgBox(0,"1",@error) $oxlsServices.ActiveWorkBook.Close MsgBox(0,"2",@error) $oxlsServices.Application.Quit MsgBox(0,"3",@error) $oxlsServices = 0 MsgBox(0,"4",@error) FileClose($xlsServices) MsgBox(0,"5",@error) ;~ ------------------------ end Search for service --------------------------------- EndFunc Here is the part of the code. I think this will be enough. This program is searching the device warranty information stored in excel file. Link to comment Share on other sites More sharing options...
water Posted February 3, 2014 Share Posted February 3, 2014 As all processing is being done in the subroutine the Excel object should be released when you quit the function. How often do you call this function? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
broliukaz Posted February 3, 2014 Share Posted February 3, 2014 As all processing is being done in the subroutine the Excel object should be released when you quit the function. How often do you call this function? One or two times. This depends on which button is pressed. But mostly only one time. I have noticed, that sometimes excel.exe process closes only after few minutes, but not immediately. I can close the whole program, but excel process closes only after a some time. Link to comment Share on other sites More sharing options...
broliukaz Posted February 3, 2014 Share Posted February 3, 2014 I have found the solution. It's strange, but when I add Sleep(100) after _ExcelBookOpen line, everything works fine! now excel.exe process closes imeediatly. Thanks everyone! Link to comment Share on other sites More sharing options...
water Posted February 3, 2014 Share Posted February 3, 2014 I once had a similar problem with Microsoft Word when there was an improper coded AddIn that was atuomatically started at open time. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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