Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default DIsabling Escape Key while dialog active

Hello

Does anyone know of a simple way to disable the "Escape"
key while a dialog box is displayed?

I imagine it would require an API call - any thoughts?

TIA

Romulus
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default DIsabling Escape Key while dialog active

My thoughts in general is that programming like this is hijacking the computer, not good.
What you should do is respond reasonably to any keypress that Windows himself doesn't
handle.

Which dialog is it ? What happens on Esc that you want to avoid ?

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"Romulus" wrote in message
...
Hello

Does anyone know of a simple way to disable the "Escape"
key while a dialog box is displayed?

I imagine it would require an API call - any thoughts?

TIA

Romulus



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default DIsabling Escape Key while dialog active

Set the cancel property of a commandbutton to True. The click event for
that button will be fired if the user hits escape with the userform active.

I agree with Harald, but this is not hijacking the functionality as it is
the intended functionality.

--
Regards,
Tom Ogilvy


Romulus wrote in message
...
Hello

Does anyone know of a simple way to disable the "Escape"
key while a dialog box is displayed?

I imagine it would require an API call - any thoughts?

TIA

Romulus



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default DIsabling Escape Key while dialog active


You could also include the following code in the form's Load event:

Application.OnKey "{ESCAPE}",""

(setting the procedure name to a zero length string disables the key)

Then to restore the ESC key, include this code in the form's Unloa
event:

Application.OnKey "{ESCAPE}"

(omitting the procedure name altogether restores the origina
functionality of the key)

Hope this helps. :cool

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default DIsabling Escape Key while dialog active

You might want to test this, because it doesn't appear to work for a
userform (when the userform has the focus). (just as onkey doesn't work when
your in edit mode)

A userform still gets the escape key when the userform has the focus.

That is the expected behavior and testing in xl97 shows it to be true.

Tested in xl2000, both modal and modeless. In modeless, when I click in the
sheet, the onkey is in effect, but when the focus is on the userform, the
userform handles the escape key. I would assume this is no different in
xl2002 or 2003 as this is the advertised behavior.

Hope that helps.

--
Regards,
Tom Ogilvy


Adiv wrote in message
...

You could also include the following code in the form's Load event:

Application.OnKey "{ESCAPE}",""

(setting the procedure name to a zero length string disables the key)

Then to restore the ESC key, include this code in the form's Unload
event:

Application.OnKey "{ESCAPE}"

(omitting the procedure name altogether restores the original
functionality of the key)

Hope this helps.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default DIsabling Escape Key while dialog active

Thanks Folks

I think I could have been clearer in my original post.
The dialog is displayed and acts as an interface for
users to enter data onto a temporary spreadsheet. when
They're done, they click a button that transfers that
data to a master data file.

I have programmed the dialogs without the top right 'X'
button, but the "Escape" key enables users to dismiss the
dialog, and it is this I want to avoid. Is there a way
to do this?

-----Original Message-----
Hello

Does anyone know of a simple way to disable the "Escape"
key while a dialog box is displayed?

I imagine it would require an API call - any thoughts?

TIA

Romulus
.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default DIsabling Escape Key while dialog active

Ok, the good old DialogSheets ? I doubt that it can be done after a while of
researching and testing. You could do it with Userforms though, is that an
option ?
--
HTH. Best wishes Harald
Followup to newsgroup only please


"Romulus" skrev i melding
...
Thanks Folks

I think I could have been clearer in my original post.
The dialog is displayed and acts as an interface for
users to enter data onto a temporary spreadsheet. when
They're done, they click a button that transfers that
data to a master data file.

I have programmed the dialogs without the top right 'X'
button, but the "Escape" key enables users to dismiss the
dialog, and it is this I want to avoid. Is there a way
to do this?



  #8   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default DIsabling Escape Key while dialog active

No - I need it to work ith users still using XL 95. i appreciate that it
can be done in UserForms, but the solution must support xl 95.

Cheers
Romulus
"Harald Staff" wrote in message
...
Ok, the good old DialogSheets ? I doubt that it can be done after a while

of
researching and testing. You could do it with Userforms though, is that an
option ?
--
HTH. Best wishes Harald
Followup to newsgroup only please


"Romulus" skrev i melding
...
Thanks Folks

I think I could have been clearer in my original post.
The dialog is displayed and acts as an interface for
users to enter data onto a temporary spreadsheet. when
They're done, they click a button that transfers that
data to a master data file.

I have programmed the dialogs without the top right 'X'
button, but the "Escape" key enables users to dismiss the
dialog, and it is this I want to avoid. Is there a way
to do this?





  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default DIsabling Escape Key while dialog active

Since dialog sheet are persistent in retaining values. set it up like this

Public bFlag As Boolean
Sub showDialog()
bFlag = True
Do While bFlag
DialogSheets(1).Show
Loop
End Sub

Sub Cancel_Button()
' MsgBox "In cancel"
If ActiveDialog.CheckBoxes(1) = xlOff Then
bFlag = False
End If
End Sub

the cancel_button code is assigned to the cancel key.


If you have an init event or if you clear values in your code, use the bflag
value there to see whether to clear or not.

In the above, as long as checkbox 1 is checked, the dialog is reshown.
There is an annoying flicker, but maybe that will disuade use of the escape
key.

--
Regards,
Tom Ogilvy





<Romu wrote in message ...
No - I need it to work ith users still using XL 95. i appreciate that it
can be done in UserForms, but the solution must support xl 95.

Cheers
Romulus
"Harald Staff" wrote in message
...
Ok, the good old DialogSheets ? I doubt that it can be done after a

while
of
researching and testing. You could do it with Userforms though, is that

an
option ?
--
HTH. Best wishes Harald
Followup to newsgroup only please


"Romulus" skrev i melding
...
Thanks Folks

I think I could have been clearer in my original post.
The dialog is displayed and acts as an interface for
users to enter data onto a temporary spreadsheet. when
They're done, they click a button that transfers that
data to a master data file.

I have programmed the dialogs without the top right 'X'
button, but the "Escape" key enables users to dismiss the
dialog, and it is this I want to avoid. Is there a way
to do this?







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
Escape key won't work Lee B Excel Discussion (Misc queries) 1 September 3rd 08 05:01 PM
Repost: Disabling Update Links dialog box Sandeep Excel Discussion (Misc queries) 3 July 30th 07 07:51 PM
Disabling Update Links dialog box Sandeep Excel Discussion (Misc queries) 0 July 27th 07 11:28 PM
How to escape this error message jamesa Excel Programming 1 October 3rd 03 05:50 PM
Disabling the enable/disable dialog box with Digital Signature CST[_2_] Excel Programming 1 September 8th 03 08:31 PM


All times are GMT +1. The time now is 02:58 AM.

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"