How to Implement a minimize feature on a combobox

2019-09-14 04:47发布

Someone please help rather a newbie in Excel-Vba. How do i implement a minimize feature at the top right panel of a combobox something just like a browser?

1条回答
相关推荐>>
2楼-- · 2019-09-14 05:52

This is modified from this posting

Drag a toggle button onto your form, and place this code anywhere in your module. Click the toggle to "minimize" and again to reverse it. Play around with the numbers to get the height and the position the way you want it.

Dim dWidth As Double
Dim wasTop, wasLeft As Integer
Private Sub ToggleButton1_Click()
    If ToggleButton1.Value = True Then
        Me.Height = Me.Height * 0.25
        wasTop = Me.Top
        wasLeft = Me.Left
        Me.Top = 400
        Me.Left = 100
    Else
        Me.Height = dWidth
        Me.Top = wasTop
        Me.Left = wasLeft
    End If
End Sub


Private Sub UserForm_Initialize()
    dWidth = Me.Height
End Sub
查看更多
登录 后发表回答