![]() |
2 questions related to Excel under Windows 98/2000
You can remove the X button BUT it is bad practice to change a standard interface. If you need to know use the Workbook_BeforeClose event to trap the event when a user clicks the X.
|
2 questions related to Excel under Windows 98/2000
Hi
Thanks for your reply to my pos I understand your suggestion NOT TO CHANGE standard interface and I've now found a way to handle my application without disabling the X button-click However, I've try to implement your Workbook_BeforeClose event just to see how it works 1) I've first declared a class module named AppCloseEventClass and containing the following code Public WithEvents App As Applicatio I could then add the following event handling procedure to the declared class module Private Sub App_WorkbookBeforeClose (ByVal Wb As Workbook, Cancel As Boolean a = MsgBox("Do you really want to close ?", vbYesNo if a = vbNo Then Cancel = Tru End Su 2) To make that event handling procedure runnable, it was necessary to initialize (in an other module the class module as follow Dim X As New AppCloseEventClas Private Sub InitApp( Set X.App = Applicatio End Su 3) After one single run of InitApp(), I was able to trap each (but too much than desired) events WorkbookBeforeClos 4) I then added the following code at the bigin of my event handling procedure to trace the events MsgBox Wb.Nam and discovered that A LOT OF Workbooks send the event and NOT ONLY the one on which the X-button was clicked Is someone aware about that behaviour and has any suggestion to better handle the WorkbookBeforeClose event Thanks Gaston 2) ----- AA2e72E wrote: ---- You can remove the X button BUT it is bad practice to change a standard interface. If you need to know use the Workbook_BeforeClose event to trap the event when a user clicks the X. |
All times are GMT +1. The time now is 07:24 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com