Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Test if WorkSheet ComboBox list is open

Hello All,

I have a combo box on a worksheet. I use the DropDown method to open
the list on the Change event and the KeyDown event to click on a button
if the ENTER key is pressed.

Private Sub cbJobField_Change()
cbJobField.DropDown
End Sub

Private Sub cbJobField_KeyDown(ByVal KeyCode As MSForms.ReturnInteger)
If KeyCode = vbKeyReturn Then
btnFind_Click
End If
End Sub

I would like to change cbJobField_KeyDown so that when the ENTER key is
pressed, if the combo box list is open, it is closed, but if it is
already closed, btnFind_Click is executed. I expect the code would look
similar to the following:

Private Sub cbJobField_KeyDown(ByVal KeyCode As MSForms.ReturnInteger)
If KeyCode = vbKeyReturn Then
If cbJobField.DroppedDown = True Then
Application.SendKeys("{ESC}")
Else
btnFind_Click
End If
End Sub

Is this at all possible? If not, does anyone have any ideas for a
workaround? I appreciate any help.

Thanks!
Sisilla

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Test if WorkSheet ComboBox list is open

Workaround:

Private Sub cbJobField_Change()
cbJobField.DropDown
Sheets("Links").Range("DropDownOpen").Value = "True"
End Sub

Private Sub cbJobField_KeyDown(ByVal KeyCode As MSForms.ReturnInteger)
If KeyCode = vbKeyReturn Then
If Sheets("Links").Range("DropDownOpen").Value = "True" Then
Sheets("Links").Range("DropDownOpen").Value = "False"
ActivateComboBox cbJobField
Else
btnFind_Click
End If
End If
End Sub

Sisilla wrote:
Hello All,

I have a combo box on a worksheet. I use the DropDown method to open
the list on the Change event and the KeyDown event to click on a button
if the ENTER key is pressed.

Private Sub cbJobField_Change()
cbJobField.DropDown
End Sub

Private Sub cbJobField_KeyDown(ByVal KeyCode As MSForms.ReturnInteger)
If KeyCode = vbKeyReturn Then
btnFind_Click
End If
End Sub

I would like to change cbJobField_KeyDown so that when the ENTER key is
pressed, if the combo box list is open, it is closed, but if it is
already closed, btnFind_Click is executed. I expect the code would look
similar to the following:

Private Sub cbJobField_KeyDown(ByVal KeyCode As MSForms.ReturnInteger)
If KeyCode = vbKeyReturn Then
If cbJobField.DroppedDown = True Then
Application.SendKeys("{ESC}")
Else
btnFind_Click
End If
End Sub

Is this at all possible? If not, does anyone have any ideas for a
workaround? I appreciate any help.

Thanks!
Sisilla


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
open worksheet with a macro (combobox) matthiasmorath Excel Programming 1 May 31st 06 02:32 PM
squashed test in combobox Conor Excel Programming 0 May 11th 06 09:25 PM
squashed test in combobox??? Conor Excel Programming 0 May 11th 06 09:16 PM
ComboBox list reliant on the entry from a different ComboBox ndm berry[_2_] Excel Programming 4 October 4th 05 04:40 PM
List Open Workbooks in a combobox JasonSelf[_21_] Excel Programming 2 September 15th 05 07:45 PM


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