BrI
07-30-2019, 05:02 AM
I have a multipage userform where I can successfully insert text into a single TextBox as follows:
Me.MultiPage1.Pages(0).txtMainAdd_1.Text = "Insert this text"
I want to do the same thing in a loop for several TextBoxes but cannot get correct syntax. I have tried variations of the code below without success. Error says could not find object.
For i = 1 To 6
Me.("MultiPage1.Pages(0).txtMainAdd_") & i.Text = "Insert Text via LOOP"
'- or -
Me.Controls("MultiPage1.Pages(0).txtMainAdd_" & i).Text = "Insert Text via LOOP"
Next i
How can I fix?
Me.MultiPage1.Pages(0).txtMainAdd_1.Text = "Insert this text"
I want to do the same thing in a loop for several TextBoxes but cannot get correct syntax. I have tried variations of the code below without success. Error says could not find object.
For i = 1 To 6
Me.("MultiPage1.Pages(0).txtMainAdd_") & i.Text = "Insert Text via LOOP"
'- or -
Me.Controls("MultiPage1.Pages(0).txtMainAdd_" & i).Text = "Insert Text via LOOP"
Next i
How can I fix?