ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Events for workbook close (https://www.excelbanter.com/excel-programming/271712-events-workbook-close.html)

Aaron Queenan

Events for workbook close
 
Are there any events when we KNOW the workbook is being closed?

The BeforeClose event is a nuisance, because the user can click cancel
afterwards. Rewriting the "Are you sure?" dialogue is a possibility, but
it's really a waste if there is a better way.

Thanks,
Aaron Queenan.



Tom Ogilvy

Events for workbook close
 
Code doesn't run in a closed workbook, so there is no afterclose event.

Regards,
Tom Ogilvy


"Aaron Queenan" wrote in message
...
Are there any events when we KNOW the workbook is being closed?

The BeforeClose event is a nuisance, because the user can click cancel
afterwards. Rewriting the "Are you sure?" dialogue is a possibility, but
it's really a waste if there is a better way.

Thanks,
Aaron Queenan.





Aaron Queenan

Events for workbook close
 
Yes, but you can subscribe to the event from somewhere other than the
workbook, and we can listen to the Application_WorkbookBeforeClose event
instead.

Thanks,
Aaron Queenan.

"Tom Ogilvy" wrote in message
...
Code doesn't run in a closed workbook, so there is no afterclose event.

Regards,
Tom Ogilvy


"Aaron Queenan" wrote in

message
...
Are there any events when we KNOW the workbook is being closed?

The BeforeClose event is a nuisance, because the user can click cancel
afterwards. Rewriting the "Are you sure?" dialogue is a possibility,

but
it's really a waste if there is a better way.

Thanks,
Aaron Queenan.







Aaron Queenan

Events for workbook close
 
If I use that, I then have to write an "Are you sure?" dialogue for every
language of Excel we want to support. Isn't there a less ridiculous way?

Thanks,
Aaron Queenan.

"Don Guillett" wrote in message
...
application.displayalerts=false

--
Don Guillett
SalesAid Software
Granite Shoals, TX

"Aaron Queenan" wrote in

message
...
Are there any events when we KNOW the workbook is being closed?

The BeforeClose event is a nuisance, because the user can click cancel
afterwards. Rewriting the "Are you sure?" dialogue is a possibility,

but
it's really a waste if there is a better way.

Thanks,
Aaron Queenan.







Tom Ogilvy

Events for workbook close
 
That doesn't change anything you have spoken of - it is still triggered
before close. Apparently you aren't asking a question, so continue to
proselytize the gathered masses.

Regards,
Tom Ogilvy


"Aaron Queenan" wrote in message
...
Yes, but you can subscribe to the event from somewhere other than the
workbook, and we can listen to the Application_WorkbookBeforeClose event
instead.

Thanks,
Aaron Queenan.

"Tom Ogilvy" wrote in message
...
Code doesn't run in a closed workbook, so there is no afterclose event.

Regards,
Tom Ogilvy


"Aaron Queenan" wrote in

message
...
Are there any events when we KNOW the workbook is being closed?

The BeforeClose event is a nuisance, because the user can click cancel
afterwards. Rewriting the "Are you sure?" dialogue is a possibility,

but
it's really a waste if there is a better way.

Thanks,
Aaron Queenan.









Aaron Queenan

Events for workbook close
 
I am asking for a way of receiving an event either when the workbook is
REALLY ready to close, or after the workbook has closed.

Regards,
Aaron Queenan.

"Tom Ogilvy" wrote in message
...
That doesn't change anything you have spoken of - it is still triggered
before close. Apparently you aren't asking a question, so continue to
proselytize the gathered masses.

Regards,
Tom Ogilvy


"Aaron Queenan" wrote in

message
...
Yes, but you can subscribe to the event from somewhere other than the
workbook, and we can listen to the Application_WorkbookBeforeClose event
instead.

Thanks,
Aaron Queenan.

"Tom Ogilvy" wrote in message
...
Code doesn't run in a closed workbook, so there is no afterclose

event.

Regards,
Tom Ogilvy


"Aaron Queenan" wrote in

message
...
Are there any events when we KNOW the workbook is being closed?

The BeforeClose event is a nuisance, because the user can click

cancel
afterwards. Rewriting the "Are you sure?" dialogue is a

possibility,
but
it's really a waste if there is a better way.

Thanks,
Aaron Queenan.











Rob Bovey

Events for workbook close
 
Hi Aaron,

What will happen if the "Are you sure?" dialogue is visible when the

OnTime
event fires? Will it fail (and therefore never call the procedure) or sit
in a queue waiting patiently?


The procedure call set by OnTime will be queued up and will fire as soon
as it has the chance.

Is there any way to tell when Excel has finished showing the dialogue,

e.g.
the message loop that handles COM events starts working again?


Not that I'm aware of, although I've never tried to subclass Excel at
this level. At any rate, I don't think it's necessary, because the procedure
set by OnTime will fire as soon as the alert dialog is dismissed, so that
will provide you with notification.

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





All times are GMT +1. The time now is 11:35 PM.

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