Why doesn't this work:
Dim p As Object
Dim lb As ListBox
Set p = MyUserForm.MultiPage1.Pages(0)
Set lb = p.Controls.Add("Forms.ListBox.1")
This code generates a "Type Mismatch" error. So instead I try this:
Dim p As Object
Dim lb As ListBox
Set p = MyUserForm.MultiPage1.Pages(0)
p.Controls.Add("Forms.ListBox.1")
Set lb = p.Controls(1)
That code generates an "Invalid Argument" error (-2147024809...)
I can get a little closer by not declaring the variable lb, like this:
Dim p As Object
Set p = MyUserForm.MultiPage1.Pages(0)
lb = p.Controls.Add("Forms.ListBox.1")
But then lb is always Null.
What the heck is going on here?! It seems I can create the ListBox successfully but can't address it after creation?
Little help?!
Bookmarks