Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default Disable the PauseBreak key

Forgot to mention that you don't need this:
Me.Hide

in the code in case your form isn't Modal.
I don't know if you can change that on the fly - would need to do some
research on that one. This would matter to you if you want to trap the
Esc instead of just disabling it.

On Jul 15, 4:47*pm, AB wrote:
This code worked for me on a userform1 with CommandButton1 :

'Userform module:

Private Sub CommandButton1_Click()

* * Me.Hide

* * Dim rng As Range

* * On Error GoTo CanclErr:
* * Application.EnableCancelKey = xlErrorHandler

* * For Each rng In ActiveSheet.Cells
* * * * If rng.Row = 2000 Then GoTo ExtFinished: 'Just to kill it it
when it takes too long - for ilustration puroposses only
* * * * rng.Value = 1' Obviously your code would do whatever it needs
to do
* * Next

ExtFinished:
* * Exit Sub

CanclErr:
* * MsgBox "Nope, you should not be cancelling this!"
* * Stop 'This is here just so that you could see when it traps the
error. You don't need it in your final code.
* * Resume

End Sub

''''''''''''''
'Standard module:

Sub tryCancel()
* *UserForm1.Show
End Sub

Give it a try.

On Jul 15, 3:58*pm, leerem wrote:



Hi,
thanks for the info I've tried placing some code in the Userform Terminate
section but it wont launch upon the keystroke combination.


Would i be asking too much if you could supply some code and at what section
would this be applied


many thanks


"AB" wrote:
check out
application.EnableCancelKey


You can set it to enable/disable/Error
and then code accordingly. The 'error' let's you trap it by raising an
error - i think the err.number=18.


On Jul 15, 2:26 pm, leerem wrote:
gentelmen,
* * * * * * I'm working on a spreadsheet that is primarily run by code, by
use of userforms.
What i need is to stop some inquisitive personell from attempting to break
out of the code by the use of Control + PauseBreak keys.


How can I therefore Disable this combination of key strokes. Should this
occur all the information held within memory on the specific userform will be
lost.


your help would be appreciated
lee- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable ALT+F11 LiAD Excel Programming 8 April 27th 09 10:14 AM
Disable # bmelt Excel Discussion (Misc queries) 8 February 18th 09 04:39 PM
Disable alt+tab Ozgur Pars[_2_] Excel Programming 2 October 12th 06 06:04 AM
Disable Alt+F11 Bob Excel Discussion (Misc queries) 3 April 27th 06 10:05 PM
disable F1 after F2 Dw70 Excel Programming 1 January 30th 05 04:58 PM


All times are GMT +1. The time now is 03:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"