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

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Dragracer

Board Regular
Joined
Jun 9, 2002
Messages
151
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
 

elgringo56

Well-known Member
Joined
Apr 15, 2002
Messages
869
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.
 

Forum statistics

Threads
1,144,275
Messages
5,723,448
Members
422,497
Latest member
dougy99

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
Top