I have a number of userforms with static controls on them. I have created a Class Module to apply event handlers to a set of texboxes I am dynamically adding to the userform. When I specifically address a userform from the Class Module I can update the value in the static controls...
IAFStep2c.Controls("chkOptIn").Value = True
But when I try to update the controls with their userform's name in a variable it doesn't work...
Dim oUserFOrm As Object
Dim formName As String
formName = "IAFStep2c"
Set oUserFOrm = UserForms.Add(formName)
oUserFOrm.Controls("chkOptIn").Value = True
I can read the value and other properties of the controls, just not update them. Can someone offer a solution to this?
EDIT
I created another spreadsheet with the class below, same result. TextBox1 and 3 get updated, textBox2 does not.
Sub doStuff()
'MsgBox ("ping")
Dim oUserFOrm As Object
Dim formName As String
formName = "frmTest"
Set oUserFOrm = UserForms.Add(formName)
frmTest.Controls("TextBox1").Value = oUserFOrm.Controls("TextBox2").Name
oUserFOrm.Controls("TextBox2").Value = "PING"
frmTest.Controls("TextBox3").Value = oUserFOrm.Controls("TextBox2").TextAlign
End Sub