This code uses the SendMessage API to drop a combo box. Simply add a combo box called cboCombo, and a button named cmdDrop. Note that if you want to close the combo, simply call the SendMessage API using the CB_SHOWDROPDOWN with False instead of True.
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As
Long
Private Const CB_SHOWDROPDOWN = &H14F 'WM_USER + 14
Private Sub cmdDrop_Click()
SendMessage cboDrop.hwnd, CB_SHOWDROPDOWN, True, 0
End Sub
Comments