HideViewComboDrop



'Declarations

'Add the following code to the declarations section of a

'basic module.


Public 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
Public Const CB_SHOWDROPDOWN = &H14F

'Form Code

'Add 2 command buttons and a combo box to a form.

'Add the following code to the form.


Sub Form_Load()
Combo1.AddItem "Item 1"
Combo1.AddItem "Item 2"
Combo1.AddItem "Item 3"
End Sub

Private Sub Command1_Click()
'label this button Show List

Dim r as Long
r = SendMessageLong(Combo1.hWnd, CB_SHOWDROPDOWN, True, 0)
End Sub

Private Sub Command2_Click()
'label this button Hide List

Dim r as Long
r = SendMessageLong(Combo1.hWnd, CB_SHOWDROPDOWN, False, 0)
End Sub

(hideviewcombodrop.html)- by Paolo Puglisi - Modifica del 25/3/2019