ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   After Close Event? (https://www.excelbanter.com/excel-programming/282816-after-close-event.html)

Don Wiss

After Close Event?
 
I have an Excel 97 spreadsheet that opens up an ActiveX server when it
starts, and closes it when it closes. It takes a couple seconds to shut
down. It would be nice to display a closing message in the StatusBar. But
if I display one on a BeforeClose event, it remains in the StatusBar after
the spreadsheet closes. When I really need is an AfterClose event that sets
it back to False, and to the default "Ready." Is there some way to achieve
this?

Thanks, Don <donwiss at panix.com.

Rob Bovey

After Close Event?
 
"Don Wiss" wrote in message
...
I have an Excel 97 spreadsheet that opens up an ActiveX server when it
starts, and closes it when it closes. It takes a couple seconds to shut
down. It would be nice to display a closing message in the StatusBar. But
if I display one on a BeforeClose event, it remains in the StatusBar after
the spreadsheet closes. When I really need is an AfterClose event that

sets
it back to False, and to the default "Ready." Is there some way to achieve
this?


Hi Don,

Is the process of shutting down this ActiveX Server asynchronous? I
wouldn't think that it should be, so something like the following ought to
work:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.StatusBar = "Shutting down...."
''' Code to close the ActiveX server here.
Application.StatusBar = False
End Sub

If the process of shutting down the server really is asynchronous then
you've got a more difficult problem, because Excel itself might be closed
before the ActiveX server is finished cleaning up. In that case you'd have
to rely on a callback from the server to tell your Excel program when it's
finished closing and wait for that callback before allowing Excel to close.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *




Don Wiss

After Close Event?
 
On Mon, 17 Nov 2003 19:49:49 -0800, "Rob Bovey" wrote:

Is the process of shutting down this ActiveX Server asynchronous? I
wouldn't think that it should be, so something like the following ought to
work:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.StatusBar = "Shutting down...."
''' Code to close the ActiveX server here.
Application.StatusBar = False
End Sub


Thanks. That worked. What I had was the shutting down line was in an
Auto_Close event, and I had tried putting the StatusBar message in a newly
created BeforeClose. I put the two StatusBar messages surrounding the code
to close in the Auto_Close and all is fine.

Don <donwiss at panix.com.


All times are GMT +1. The time now is 03:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com