PC Review


Reply
Thread Tools Rate Thread

BeforeClose Event problem

 
 
Jac Tremblay
Guest
Posts: n/a
 
      9th Jan 2009
Hi,
On the BeforeClose event, I delete the command button and toolbar specific
to the application. These controls are created in the Workbook_Open event.
When the user clicks the Excel close button and cancels his action, the
BeforeClose event has already fired and the toolbar has been deleted.
What can I do? Is it possible to avoid this delete somehow? Can one catch
the Cancel button in the close message from Excel?
I could recreate the controls in that particular case, but where?
Thanks.
--
Jac Tremblay
 
Reply With Quote
 
 
 
 
JLGWhiz
Guest
Posts: n/a
 
      10th Jan 2009
This is one way, lacking any other information about the objective.
You could put in a message box just before the delete line and ask if the
user wants to continue the delete. If they choose not to delete, you would
need a GoTo to some other part of the code to get them out of the before
close procedure.

"Jac Tremblay" wrote:

> Hi,
> On the BeforeClose event, I delete the command button and toolbar specific
> to the application. These controls are created in the Workbook_Open event.
> When the user clicks the Excel close button and cancels his action, the
> BeforeClose event has already fired and the toolbar has been deleted.
> What can I do? Is it possible to avoid this delete somehow? Can one catch
> the Cancel button in the close message from Excel?
> I could recreate the controls in that particular case, but where?
> Thanks.
> --
> Jac Tremblay

 
Reply With Quote
 
Jac Tremblay
Guest
Posts: n/a
 
      12th Jan 2009
Hi JLGWhiz,
That solution is not acceptable, sorry.
On the Workbook_Open event, the code creates a toolbar and on the
Workbook_BeforeClose event this toolbar is deleted. I cannot ask the user's
opinion about whether or not to keep the toolbar. This toolbar is only useful
for this application (and is necessary) and it must be deleted if the
application is closed.
I want to know if there is some way (Windows API maybe) to detect the click
on the Cancel button in the Excel close window form.
Thanks anyway and have a good day.
--
Jac Tremblay


"JLGWhiz" wrote:

> This is one way, lacking any other information about the objective.
> You could put in a message box just before the delete line and ask if the
> user wants to continue the delete. If they choose not to delete, you would
> need a GoTo to some other part of the code to get them out of the before
> close procedure.
>
> "Jac Tremblay" wrote:
>
> > Hi,
> > On the BeforeClose event, I delete the command button and toolbar specific
> > to the application. These controls are created in the Workbook_Open event.
> > When the user clicks the Excel close button and cancels his action, the
> > BeforeClose event has already fired and the toolbar has been deleted.
> > What can I do? Is it possible to avoid this delete somehow? Can one catch
> > the Cancel button in the close message from Excel?
> > I could recreate the controls in that particular case, but where?
> > Thanks.
> > --
> > Jac Tremblay

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
BeforeClose Event Yazeed Microsoft Powerpoint 3 20th Jul 2009 01:48 PM
BeforeClose Event LeAnn Microsoft Excel Programming 1 21st Mar 2008 11:10 PM
BeforeClose event help azu_daioh@yahoo.com Microsoft Excel Programming 3 22nd Jun 2007 10:02 AM
BeforeClose Event =?Utf-8?B?SlQ=?= Microsoft Excel Programming 2 10th Apr 2007 03:52 PM
problem with beforeclose event Gordon Microsoft Excel Programming 1 30th Sep 2004 11:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:00 AM.