问题
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:
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
来源:https://stackoverflow.com/questions/6972598/how-to-implement-a-minimize-feature-on-a-combobox-in-excel-vba