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

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
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>
 
Upvote 0
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>
 
Upvote 0
just as a repost, does anyone have any ideas how to password protect crtl-break?
 
Upvote 0

Forum statistics

Threads
1,222,313
Messages
6,165,285
Members
451,949
Latest member
bovacik

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