Excel VBA ComboBox DropDown Button Size--changed itself

前端 未结 7 1640
忘了有多久
忘了有多久 2020-12-22 07:25

I have a workbook with several comboboxes (and listboxes) and a lot of vba written around them. I\'ve used the same code in the Workbook_Open procedure to format them for we

7条回答
  •  余生分开走
    2020-12-22 07:35

    I spent a lot of time but no suitable solution in the internet.

    I had the problem that on my laptop screen (not on the extended desktop monitor in the docking station!) the font size of a activeX combobox in a worksheet got smaller every time I clicked the dropdown button. Until the dropdown button is inaccessable small.

    Manually I could reset the font size by changing the combobox size in the developer mode.

    By VBA I do following which solves Microsofts problem:

    Private Sub MyComboBox_DropButtonClick()
    'MyComboBox.Font.Size = 12 'Has no effect!!!
    Dim CbxWidth = 300 As Single 'How big the combobox should be
    MyComboBox.Width = CbxWidth + 1 
    ComboboxUpdate 'or whatever you want to do
    MyComboBox.Width = CbxWidth 
    End Sub
    

    Hope it dont disturb if I write some german words to help also people in my native laguage:

    1. Combobox Schrift wird kleiner und kleiner

    2. Combobox Schrift ändert sich selbstständig

    3. Combobox Schriftgrösse automatisch kleiner

    4. Combobox automatische Anpassung Schriftgröße deaktivieren

提交回复
热议问题