Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Error handling and escape key

I'm trying to catch the {Escape} key and not allow it to put up an
error when my form is open. I have one of my command buttons set to
cancel true already, but it doesn't always catch the key press. I've
found some mention of using this

On Error GoTo ErrorHandler
Application.EnableCancelKey = xlErrorHandler

But I'm not really sure where to put these lines. I put them in my
UserForm_Initialize sub and I get 'Label not defined' for ErrorHandler
on compile. I'm not exactly sure where I should put this where it
will always be active. Any help would be appreciated.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Error handling and escape key

Have you tried Application.OnKey?

Application.OnKey "{ESC}", ""
will disable the Escape key,
Application.OnKey "{ESC}"
will re-enable


HTH
Roger
Shaftesbury (UK)




"Jeff" wrote in message
oups.com...
I'm trying to catch the {Escape} key and not allow it to put up an
error when my form is open. I have one of my command buttons set to
cancel true already, but it doesn't always catch the key press. I've
found some mention of using this

On Error GoTo ErrorHandler
Application.EnableCancelKey = xlErrorHandler

But I'm not really sure where to put these lines. I put them in my
UserForm_Initialize sub and I get 'Label not defined' for ErrorHandler
on compile. I'm not exactly sure where I should put this where it
will always be active. Any help would be appreciated.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Error handling and escape key

Jeff,
You'll need the

ErrorHandler:

Label in the same module that calls it.




Have you tried Application.OnKey?

Application.OnKey "{ESC}", ""
will disable the Escape key,
Application.OnKey "{ESC}"
will re-enable

Not sure just how effective this would be in a user form though.

HTH
Roger
Shaftesbury (UK)



"Jeff" wrote in message
oups.com...
I'm trying to catch the {Escape} key and not allow it to put up an
error when my form is open. I have one of my command buttons set to
cancel true already, but it doesn't always catch the key press. I've
found some mention of using this

On Error GoTo ErrorHandler
Application.EnableCancelKey = xlErrorHandler

But I'm not really sure where to put these lines. I put them in my
UserForm_Initialize sub and I get 'Label not defined' for ErrorHandler
on compile. I'm not exactly sure where I should put this where it
will always be active. Any help would be appreciated.



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
Error Handling - On Error GoTo doesn't trap error successfully David Excel Programming 9 February 16th 06 05:59 PM
Error Handling Francis Brown Excel Programming 0 November 30th 05 06:17 PM
Error handling with a handling routine ben Excel Programming 0 March 15th 05 03:01 PM
Escape On Error methods in Subs Esteban404 Excel Programming 4 July 15th 04 10:16 PM
How to escape this error message jamesa Excel Programming 1 October 3rd 03 05:50 PM


All times are GMT +1. The time now is 07:40 PM.

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

About Us

"It's about Microsoft Excel"