I have a Userform with 15 Checkboxes on it, which is in development. Every tiome the User decides to change the bits at the top of the form (the Company logo, the headings etc.), I need to shift the checkboxes up or down so the form looks reasonable.
I decided to knock together a quick VBA process to adjust the position of the Checkboxes (see below). I execute this from a "free standing" Module ('cos it's just for me to use). It works perfectly, except that if I double click on the CBForm, the Checkboxes are still in their original positions (even though the "CBForm.Show" shows them in their "new" positions etc.). Presumably I'm missing a "save" or "update" option at the end of the loop, but I can't find one.
Can anyone help?
Code:
Sub CBSetPos()
Const cintHeight As Integer = 15
Const cintTop As Integer = 50
Dim intPtr As Integer
Dim intOldTop As Integer
Dim intTop As Integer
Dim strCBName As String
intTop = cintTop - cintHeight
For intPtr = 1 To 15
intTop = intTop + cintHeight
strCBName = "Checkbox" & intPtr
intOldTop = CBForm.Controls(strCBName).Top
CBForm.Controls(strCBName).Top = intTop
CBForm.Controls(strCBName).Caption = strCBName & " " & intTop
Debug.Print strCBName & ":" & "Was " & intOldTop & " now " & intTop
Next intPtr
CBForm.Show
End Sub