Sign in to follow this  
Followers 0
osxecuter

_ExcelClosebook not closing excel process

4 posts in this topic

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--

Share this post


Link to post
Share on other sites



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 :)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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
Another 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.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0