View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff[_9_] Harald Staff[_9_] is offline
external usenet poster
 
Posts: 2
Default VBA Combobox "Enter"

If it's an ActiveX combobox then catch Enter in its Keydown event like this:

Private Sub ComboBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
If KeyCode = 13 Then
KeyCode = 0 'cancel the keystroke
MsgBox "Entered!" 'do something custom
End If
End Sub

Ths Forms combos don't have events like this.

HTH. Best wishes Harald


"arceaf" skrev i melding
...

Hi,

I'm trying to program VBA to hit the "Enter" key in a Combo Box, but I
don't remember the proper code. Here is what I have:

Application.Shapes("ComboBox1") = True

Can anyone help me out?

Thanks!




--
arceaf