Option ExplicitPrivate Const CB_FINDSTRING = &H14C Private Const CB_SETCURSEL = &H14E Private Const CB_SELECTSTRING = &H14DPrivate Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As LongPrivate Sub Command1_Click() Dim i As Long i = SendMessage(外部combobox的句柄, CB_FINDSTRING, 0&, ByVal "你要查找的内容") If i = -1 Then Exit Sub SendMessage 外部combobox的句柄, CB_SETCURSEL, i, 0或者SendMessage 外部combobox的句柄, CB_SELECTSTRING, 0&, ByVal "你要查找的内容" End Sub
Private Const CB_SETCURSEL = &H14E
Private Const CB_SELECTSTRING = &H14DPrivate Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As LongPrivate Sub Command1_Click()
Dim i As Long
i = SendMessage(外部combobox的句柄, CB_FINDSTRING, 0&, ByVal "你要查找的内容")
If i = -1 Then Exit Sub
SendMessage 外部combobox的句柄, CB_SETCURSEL, i, 0或者SendMessage 外部combobox的句柄, CB_SELECTSTRING, 0&, ByVal "你要查找的内容"
End Sub