ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Combobox "Enter" (https://www.excelbanter.com/excel-programming/448958-vba-combobox-enter.html)

arceaf

VBA Combobox "Enter"
 
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!

GS[_2_]

VBA Combobox "Enter"
 
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



Harald Staff[_9_]

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





All times are GMT +1. The time now is 10:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com