Option Explicit
Private Declare Function SendMessageLong Lib _
"user32" Alias "SendMessageA" (ByVal hwnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, _
ByVal lParam As Long) As Long
Private Const CB_SHOWDROPDOWN = &H14F
Private Const CB_SELECTSTRING = &H14D
Private Sub Combo1_Change()
Debug.Print "Combo1_Change"
Dim lRet As Long
ComboListVisible Combo1, True
lRet = SendMessageLong(Combo1.hwnd, CB_SELECTSTRING, 0, StrPtr(Combo1.Text))
Debug.Print lRet
End Sub
Private Sub ComboListVisible(Combo As ComboBox, ByVal Flag As Boolean)
Dim lRet As Long
lRet = SendMessageLong(Combo.hwnd, CB_SHOWDROPDOWN, Flag, 0)
Combo.MousePointer = 0 'иначе мышь пропадает при вводе некого значения и нажатия Enter
End Sub
Private Sub Form_Load()
Dim i As Long
For i = 1 To 20
Combo1.AddItem i
Next i
End Sub
Сейчас этот форум просматривают: SemrushBot и гости: 54