How to Implement a minimize feature on a combobox in Excel-Vba?

拈花ヽ惹草 提交于 2019-12-13 03:14:43

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!