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
You've run into the problem of using ActiveX controls on Worksheets, I've had the same problem and it is intermittent and randomly does it.
The only way I've found to truly fix things is to use forms controls. These are much more stable on worksheets although hidden from intellisense unless you choose to show hidden objects. They are also quite flexible and offer a good deal of functionality - unless you need events as they don't fire them.
I had the same issue, no idea why, but if you resize it, then it becomes normal again. So I inserted the followings to resolve:
Private Sub ComboBox1_LOSTFocus()
Application.ScreenUpdating = False
ActiveSheet.Shapes.Range(Array("ComboBox1")).Select
ActiveSheet.Shapes("ComboBox1").ScaleWidth 1.25, msoFalse, _
msoScaleFromTopLeft
ActiveSheet.Shapes("ComboBox1").ScaleHeight 1.25, msoFalse, _
msoScaleFromTopLeft
ActiveSheet.Shapes("ComboBox1").ScaleWidth 0.8, msoFalse, _
msoScaleFromTopLeft
ActiveSheet.Shapes("ComboBox1").ScaleHeight 0.8, msoFalse, _
msoScaleFromTopLeft
Application.ScreenUpdating = True
End sub
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:
Combobox Schrift wird kleiner und kleiner
Combobox Schrift ändert sich selbstständig
Combobox Schriftgrösse automatisch kleiner
Combobox automatische Anpassung Schriftgröße deaktivieren
I did some poking around and found if you have PageBreakPreview ON, it will cause the resizing problem. Go back to Normal View and the problem goes away.
I just move the shape to fix
Private Sub MyComboBox_DropButtonClick()
ActiveSheet.Shapes("ComboBox1").Top = 1
ActiveSheet.Shapes("ComboBox1").Top = 2
End Sub
With listboxes, to prevent them from resizing when you change font or re-open the file, go into the listbox properties and change the "Integral Height" to false.