I'm trying to create a new user form in VBA with the help of:
Automatically creating checkboxes on a userform, fed from array
Dim SelectionForm As Control
For r = 1 To UBound(individualValues)
SelectionForm.height = UBound(individualValues) * 30
Set c = SelectionForm.Controls.Add("Forms.CheckBox.1", "Checkbox" & r,True)
With c
.Caption = individualValues(r)
.Width = 100
.height = 20
.Top = r * 20
.Left = 10
End With
Next r
SelectionForm.Show
But I'm stuck with foolowing error on Dim c as Control
:
User-defined type not defined
My idea is to create a new user form on VBA and populate it with checkboxes (from an array, instead of a range as in the link).
The code is working when I use an existing user form, but I would like to share my code with others, and then it would be a bit akward to have them create a new userform named UserForm1 by hand - if you know what I mean.
So the main issue here is to declare a new user form in a macro.
I also wonder how this has worked with those people in the URL, as it's only from 2014 and it seems to have worked then. So I wonder if there's been an update that has discontinued a certain library or what's the issue here.