First off, I would like to thank all of the Excel MVP's in advance for their help. I know that they are all busy and donate a large portion of their time trying to help struggling novice coders, such as myself.
Here's my problem - I use the folowwing code to create a multipage form that dynamically loads a label and a textbox.
Set Mycmd = Me.MultiPage1.Pages("Page1").Controls.Add("Forms.Label.1")
Mycmd.Left = 1
Mycmd.Top = 5 'i + 25
Mycmd.Width = 25
Mycmd.Height = 20
Mycmd.Name = "lblName"
Mycmd.Caption = "Brian"
Mycmd.Visible = True
Set Mycmd1 = Me.MultiPage1.Pages("Page1").Controls.Add("Forms.TextBox.1")
Mycmd1.Left = 35
Mycmd1.Top = 5 'i + 25
Mycmd1.Width = 35
Mycmd1.Height = 20
Mycmd1.Name = "txtName"
In a separate sub procedure I have the following code to complete the addition of the form controls
Private Sub MultiPage1_AddControl(ByVal Index As Long, ByVal Control As MSForms.Control)
End Sub
I can get the form and controls to load just fine, but when I try and retrieve the text that has been entered into the textbox that I have named "txtName", I am given an error. Here's the code I'm using.
ws.Cells(4, 1).Value = Me.txtName.Value
Any ideas???
Thanks again for your help
Here's my problem - I use the folowwing code to create a multipage form that dynamically loads a label and a textbox.
Set Mycmd = Me.MultiPage1.Pages("Page1").Controls.Add("Forms.Label.1")
Mycmd.Left = 1
Mycmd.Top = 5 'i + 25
Mycmd.Width = 25
Mycmd.Height = 20
Mycmd.Name = "lblName"
Mycmd.Caption = "Brian"
Mycmd.Visible = True
Set Mycmd1 = Me.MultiPage1.Pages("Page1").Controls.Add("Forms.TextBox.1")
Mycmd1.Left = 35
Mycmd1.Top = 5 'i + 25
Mycmd1.Width = 35
Mycmd1.Height = 20
Mycmd1.Name = "txtName"
In a separate sub procedure I have the following code to complete the addition of the form controls
Private Sub MultiPage1_AddControl(ByVal Index As Long, ByVal Control As MSForms.Control)
End Sub
I can get the form and controls to load just fine, but when I try and retrieve the text that has been entered into the textbox that I have named "txtName", I am given an error. Here's the code I'm using.
ws.Cells(4, 1).Value = Me.txtName.Value
Any ideas???
Thanks again for your help