ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   2 questions related to Excel under Windows 98/2000 (https://www.excelbanter.com/excel-programming/293923-2-questions-related-excel-under-windows-98-2000-a.html)

Gaston AGON

2 questions related to Excel under Windows 98/2000
 
Hi,

I have 2 questions relative to Excel under Windows 98/2000 to submit to your attention :

1) How can I DEACTIVATE and REACTIVATE (from within a Visualbasic application)
the buttons marked [X] and labeled "Close the window" (in each Excel-document-window) and "Close"
(in the Excel-window itself) ?
Note: the button is located at the right upper corner of the window

2) How can I access (in an Excel-document) the key [Start Prompt...] under menu path
[Edition] -- [Links] -- [Start Prompt...] when the key [Links] is not activable (greyed) ?

Thanks for repying me at :





AA2e72E[_2_]

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.

Gaston AGON

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