PDA

View Full Version : Excel Userform - Dynamic Controls - Type Mismatch?



n8Mills
12-13-2008, 04:16 PM
Hey, all!

I followed the well-documented steps at TechTrax (http://pubs.logicalexpressions.com/pub0009/LPMArticle.asp?ID=259) but they don't talk about experiencing a Type mismatch. It errors on the "Set chkRemv" line.

Here's my code and attachment. Any thoughts?

Sub test()

Dim chkRemv As CheckBox

Set chkRemv = frmAddMods.Controls.Add("Forms.checkbox.1", "chkRemv1", True)

With chkRemv
.Top = 72
.Left = 18
.Width = 12
.Height = 12
.Value = True
End With

frmAddMods.Show

End Sub
Thanks!

Nate

JimmyTheHand
12-13-2008, 04:26 PM
Try

Dim chkRemv As MSForms.CheckBox
Jimmy

n8Mills
12-13-2008, 04:51 PM
w00t!

Thanx, Holmes!