Disablling Crlt Break Function

Kavy

Well-known Member
Joined
Jun 25, 2007
Messages
607
Anyone know how to password protect the Crlt Break Fuction when running code?
thanks
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,887
Hi Kavy

Check the help on

Application.EnableCancelKey

Hope this helps
PGC
 

Kavy

Well-known Member
Joined
Jun 25, 2007
Messages
607
I think i need some help, i am scared i will mess this up badly

If I put this at the start of every procedure i have

<code>
On Error GoTo handleCancel
Application.EnableCancelKey = xlErrorHandler
</code>

and this at the end, will it put a password on crtl-Break?
<code>

handleCancel:
If Err = 18 Then
resp = MsgBox "Please Enter the Password"
if resp = "Password" then
exit sub
end if
End If

</code>
 

Kavy

Well-known Member
Joined
Jun 25, 2007
Messages
607
Hello, I found this through google, any thoughts of on if it may help me?

Thanks!
(would i need it at the start of every sub, or just every form) or..?
sorry i am compelty lost on this one

<code>
Sub YourSubroutine()

On Error Goto ErrHndlr

Application.UserControl = False

'Unprotect the Sheet
Sheets(1).Unprotect Password:="dsi"

'
'Do all of your work here
'

'Protect the Sheet
Sheets(1).Protect Password:="dsi"

Application.UserControl = True

Exit Sub

ErrHndlr:
MsgBox "Error No: " & Err.Number & vbCrLf & _
"Description: " & Err.Description
Err.Clear

'Protect the Sheet
Sheets(1).Protect Password:="dsi"
Application.UserControl = True
End Sub

</Code>
 

Kavy

Well-known Member
Joined
Jun 25, 2007
Messages
607
just as a repost, does anyone have any ideas how to password protect crtl-break?
 

Forum statistics

Threads
1,181,362
Messages
5,929,535
Members
436,676
Latest member
Mavri

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