LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default ActiveX Control Return Keypress MsgBox Loop

A simplified version of my problem. Consider a single command button on a
blank worksheet. I want to be able execute the command button Click event
with both the Return key and a mouse click. I want to be able to clear the
message box with both the Return key and a mouse click. If I try to clear the
message box with the Return key, it also executes the command button Click
event again. So using the Return key to clear the message box puts you into
a loop. Any ideas are greatly appreciated.

Thanks, Tom

'In ThisWorkbook
Private Sub Workbook_Open()
Sheet1.Button1.Activate
End Sub

'In Sheet1
Private Sub Button1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
Select Case KeyCode
'Return is only key press that we care about
Case vbKeyReturn
Call Button1_Click
End Select
End Sub
Private Sub Button1_Click()
MsgBox "I am stuck in a loop when I use the Return key to clear this message
box" & vbNewLine & "but everything is fine if I use a mouse click to clear
this message box"
End Sub
 
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
2007 Form Control/ActiveX Control font difference Nikko963 Excel Discussion (Misc queries) 0 April 15th 09 04:21 PM
publish activeX combobox and other activeX control irene c Excel Programming 0 March 19th 07 07:19 AM
Help with using an activex control CrazyPhilll Excel Programming 7 April 24th 06 09:28 AM
Loop with activeX optionbuttons. Jan Vente Excel Programming 3 February 8th 06 03:39 PM
How to control "Date Time Picker ActiveX Control" Jafery Excel Programming 1 July 21st 05 02:38 PM


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