After Close Event?

D

Don Wiss

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

Rob Bovey

Don Wiss said:
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 *
 
D

Don Wiss

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top