osxecuter Posted February 17, 2009 Posted February 17, 2009 Hi all, I noticed today that the _ExcelClosebook function is not ending the excel processes created with the _ExcelBookOpen or _Excelbooknew functions. I can still see all the excel.exe processes in Windows XP task manager even though i used _ExcelClosebook in all instances of the objects that i initiated. Is this normal behaviour please report your experiences with the same. --osXecuter--
enaiman Posted February 17, 2009 Posted February 17, 2009 Have you checked if that "Excell" process wasn't in the Task Manager before running your script? If your script terminates due to an error then your "Close" function is not executed and the previous created Excell proces is not closed. _ExcelClosebook works and it closes the process ... if it is executed It might be worth a little bit more research on what's happening on your computer. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
Bowmore Posted February 17, 2009 Posted February 17, 2009 Hi all, I noticed today that the _ExcelClosebook function is not ending the excel processes created with the _ExcelBookOpen or _Excelbooknew functions. I can still see all the excel.exe processes in Windows XP task manager even though i used _ExcelClosebook in all instances of the objects that i initiated. Is this normal behaviour please report your experiences with the same. --osXecuter-- I've been using the Excel.au3 udf in the last few days and can confirm what you have observed. Looking at the _ExcelClosebook function it would seem (see below) that if the object passed to it is an open workbook it closes the workbook but leaves the Excel application open. if the object is not a workbook it closes the application. The solution I used was to _ExcelClosebook twice The first time closes the book the second call closes the application Switch $sObjName Case "_Workbook" If $fSave Then $oExcel.Save ; Check if multiple workbooks are open ; Do not close application if there are If $oExcel.Application.Workbooks.Count > 1 Then $oExcel.Close ; Restore the users specified settings $oExcel.Application.DisplayAlerts = $fDisplayAlerts $oExcel.Application.ScreenUpdating = $fScreenUpdating Else $oExcel.Application.Quit EndIf Case "_Application" If $fSave Then $oExcel.ActiveWorkBook.Save $oExcel.Quit Case Else Return SetError(1, 0, 0) EndSwitch "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook
seandisanti Posted February 17, 2009 Posted February 17, 2009 I've been using the Excel.au3 udf in the last few days and can confirm what you have observed. Looking at the _ExcelClosebook function it would seem (see below) that if the object passed to it is an open workbook it closes the workbook but leaves the Excel application open. if the object is not a workbook it closes the application. The solution I used was to _ExcelClosebook twice The first time closes the book the second call closes the application Switch $sObjName Case "_Workbook" If $fSave Then $oExcel.Save ; Check if multiple workbooks are open ; Do not close application if there are If $oExcel.Application.Workbooks.Count > 1 Then $oExcel.Close ; Restore the users specified settings $oExcel.Application.DisplayAlerts = $fDisplayAlerts $oExcel.Application.ScreenUpdating = $fScreenUpdating Else $oExcel.Application.Quit EndIf Case "_Application" If $fSave Then $oExcel.ActiveWorkBook.Save $oExcel.Quit Case Else Return SetError(1, 0, 0) EndSwitchAnother option that you have that is probably a bit easier is just to use the .Quit method of your application object. It exists cleanly, and prompts you to save any unsaved work.
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