'My Userform keep shrinking after every use
Almost every time I use my user form, it shrinks, and after a few times it gets too small to see and I have to go back into the forms on my project and drag it until the size is large again. Is this a result of my code, or is there something that I can do to fix this?
Option Explicit
' called on click of "OK" button
Private Sub CommandButton1_Click()
MyFile = Me.ComboBox1.Value
Unload Me
End Sub
' called on click of "Cancel" button
Private Sub CommandButton2_Click()
Stopped = True
Unload Me
End Sub
' loads the combo box with the names of all available workbooks
Private Sub UserForm_Initialize()
Dim wkb As Workbook
With Me.ComboBox1
For Each wkb In Application.Workbooks
If wkb.Name <> ActiveWorkbook.Name Then
.AddItem wkb.Name
End If
Next wkb
End With
End Sub
Solution 1:[1]
If you have this issue, you may like to check; https://www.mrexcel.com/board/threads/userforms-shrink-on-successive-openings-of-an-excel-file.1078705/ For me, adding the following to the userform code at least kept the display right.
Private Sub UserForm_Initialize()
With frm40_Overview1
Height = 600
Width = 800
End With
Application.ScreenUpdating = True
End Sub
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Neil Bates |
