Here is a sample of code I am trying.
Public Sub AlignHdiTbxs()
Dim frm As ufViewCourse
Dim ctl As Control
Dim i As Integer, j As Integer
Dim iWidth As Long
Dim iHeight As Long
Dim iLeft As Long
Dim iTop As Long
Set frm = New ufViewCourse
For i = 0 To frm.Controls.Count - 1
Set ctl = frm.Controls(i)
If Left(ctl.Name, 6) = "tbxHdi" Then
Debug.Print ctl.Name, ctl.Height, ctl.Left, ctl.Top, ctl.Width
If Len(ctl.Name) = 7 Then
iLeft = frm.Controls("tbxPar" & Right(ctl.Name, 1)).Left
ctl.Left = iLeft
End If
If Len(ctl.Name) = 8 Then
iLeft = frm.Controls("tbxPar" & Right(ctl.Name, 2)).Left
ctl.Left = iLeft
End If
End If
Next i
End Sub
The above code addresses the UserForm and its controls. The dimensions of the control print out correctly, but the change does not occur. This particular rendition is trying to update the Left property of all of the text boxes whose names start with tbxHdi. There are 18 if them on the form. The code tries to align tbxHdin (n is an integer from 1 to 18) to match a text box named tbxParn (same integer). That is the purpose of all the code from if(Left… to the last end if before Next i. There are no errors, but no changes are made to the controls.
I have tried: ufViewcourse.COntrols(“tbxParTotal”).height = 15 in the immediate window of the debugger and the same thing happens: No Error, no change.
Any ideas?
Thanks