disable the x key

johny

Board Regular
Joined
Jul 15, 2002
Messages
69
Hello
I have a sheet called "informaion" which is set up already not display any toolbars or menubar etc. I can't figure out how to get rid of the title bar or should I say caption
name. If there is a way please help. The other way would be to disable the [x] in the
top right of excel which is located on the
caption bar/titlebar of what the user has Open at the time.Also if they click the excel symbol they can close all open files
I need a way to stop this. I have button set up for proper closing. Please help Thanks Johny
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
You can disable all closing function unless a certian cell contains a value.

Use your save button to add a value to this cell. Delete the contains of this cell in your Auto_open macro.

Try this macro, it should get you started.<pre>
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Worksheets("Sheet1").Range("A1") = "" Then
Cancel = True
Application.EnableCancelKey = xlInterrupt
End If
End Sub</pre>
This message was edited by Dragracer on 2002-09-26 19:17
 
Upvote 0
open the macro editor (alt + F11)
Create a module and put the following in it

Public yourvariable As Boolean 'Set yourvariable for shut down

Then put something like this in the workbook section.

Public Sub Workbook_BeforeClose(Cancel As Boolean)
If yourvariable = True Then GoTo endit: ' checks if your variable is true
MsgBox "Please Use the Exit Program Button to close this program"
Cancel = True
endit:
ActiveWorkbook.Saved = True
End Sub

Then, in the code for your close button, put

yourvariable = true

before closeing. With this, they can only close with your button.
 
Upvote 0

Forum statistics

Threads
1,214,972
Messages
6,122,530
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top