Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default working hotkey even if any control has focus in userform



i want to close the userform if press the esc key.
Current, the userform have many controls.

in that case, even if any control has focus, i want to close the
userform when the esc key pressed.

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default working hotkey even if any control has focus in userform

Add a button to the form, and code like so

Private cmdEsc_Click()
Unload Me
End Sub

and set the Cancel property of that button to True

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"x taol" wrote in message
...


i want to close the userform if press the esc key.
Current, the userform have many controls.

in that case, even if any control has focus, i want to close the
userform when the esc key pressed.

*** Sent via Developersdex http://www.developersdex.com ***



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default working hotkey even if any control has focus in userform


thanks bob.
then, I will automate your source code.

Private cmdEsc_Click()
Unload Me
End Sub

my source code follow.
with me.controls.add("forms.commandbutton.1")
Left = 10
Top = 10
Width = 0
Height = 0
Cancel = True
End With
and then i don't know

*** Sent via Developersdex http://www.developersdex.com ***
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default working hotkey even if any control has focus in userform

Don't add the button dynamically, add it at design.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"x taol" wrote in message
...

thanks bob.
then, I will automate your source code.

Private cmdEsc_Click()
Unload Me
End Sub

my source code follow.
with me.controls.add("forms.commandbutton.1")
Left = 10
Top = 10
Width = 0
Height = 0
Cancel = True
End With
and then i don't know

*** Sent via Developersdex http://www.developersdex.com ***



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
making hotkey in textbox in userform x taol Excel Programming 1 June 3rd 06 08:27 AM
select [a1]cell when hotkey(ctrl+q) pressed, after userform load x taol Excel Programming 0 January 27th 06 10:01 PM
Statement to give focus to a specific control on a UserForm? Fred Holmes Excel Programming 3 December 20th 04 07:56 PM
Set Focus Problem for textbox control on multipage control ExcelDeveloperSPR Excel Programming 1 July 16th 04 08:54 PM
Focus on Control before UserForm(s) pop up Bob Phillips[_6_] Excel Programming 0 May 5th 04 04:03 PM


All times are GMT +1. The time now is 11:13 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"