ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   disable the close "X" icon (https://www.excelbanter.com/excel-programming/335232-disable-close-x-icon.html)

Andy

disable the close "X" icon
 
I want to disable the close "X" icon on a workbook and worksheet. I have a
EXIT button on the worksheet aleady. Thanks for your help in advance!

Stefi

disable the close "X" icon
 
ToolsProtectionWorkbooks
Check the Window CheckBox
Stefi


€žAndy€ť ezt Ă*rta:

I want to disable the close "X" icon on a workbook and worksheet. I have a
EXIT button on the worksheet aleady. Thanks for your help in advance!


Patrick Molloy[_2_]

disable the close "X" icon
 
name a cell 'GoodToClose and set its value to FALSE

your exit button code should set this to TRUE

Add the following code to the code page of ThisWorkbook

Option Explicit
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Cancel = Not (ThisWorkbook.Names.Item("GoodToClose").RefersToRa nge = True)
End Sub

The Cancel variable will be true, thus preventing the workbook closing if
the value of the range 'GoodToClose' is not set to TRUE
Note: This will also prevent Excel itself from closing.



"Andy" wrote:

I want to disable the close "X" icon on a workbook and worksheet. I have a
EXIT button on the worksheet aleady. Thanks for your help in advance!


Andy

disable the close "X" icon
 
OK! Thanks again!

"Patrick Molloy" wrote:

name a cell 'GoodToClose and set its value to FALSE

your exit button code should set this to TRUE

Add the following code to the code page of ThisWorkbook

Option Explicit
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Cancel = Not (ThisWorkbook.Names.Item("GoodToClose").RefersToRa nge = True)
End Sub

The Cancel variable will be true, thus preventing the workbook closing if
the value of the range 'GoodToClose' is not set to TRUE
Note: This will also prevent Excel itself from closing.



"Andy" wrote:

I want to disable the close "X" icon on a workbook and worksheet. I have a
EXIT button on the worksheet aleady. Thanks for your help in advance!


Andy

disable the close "X" icon
 
Stefi, thanks very much!

"Stefi" wrote:

ToolsProtectionWorkbooks
Check the Window CheckBox
Stefi


€žAndy€ť ezt Ă*rta:

I want to disable the close "X" icon on a workbook and worksheet. I have a
EXIT button on the worksheet aleady. Thanks for your help in advance!



All times are GMT +1. The time now is 06:46 PM.

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