VBA Combobox "Enter"

A

arceaf

Hi

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

Application.Shapes("ComboBox1") = Tru

Can anyone help me out

Thanks
 
G

GS

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!

A Combobox triggers via its _Change event. You need to change its
content to the text item that you want it to display. The text items
are its list, and so you must use one of these or enter new text you
want to add to its list. The needed code depends on which control (Form
or ActiveX) you're working with.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 
H

Harald Staff

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top