n8Mills
12-20-2008, 12:08 AM
Hey all (again)!
I've created a userform (as mentioned in previous posts) that populates controls dynamically. The following statement doesn't work as it does with textboxes, checkboxes, etc.
Set sliderClass(sliderNum - 1).mySlider = Me.Controls.Add("Forms.Slider.1", "slider" & sliderNum) It throws a "Invalid class string" error, which I believe pertains to the "Forms.Slider.1" portion of the statement, or maybe even everything after the "=" there. The Slider ActiveX Control 6.0 (SP6) is not part of the MSForms Object Library, so I believe I need a different statement to add it to the userform. I'm also considering whether I need to add the reference in the "Tools" menu.
I believe I'm on the right track as Intellisense was prompting me with the properties in the following With block:
With sliderClass(sliderNum - 1).mySlider
.Top = 48 + (sliderNum * 18)
.Width = 204
.Height = 12
.Left = 72
.Value = Range("slider" & sliderNum)
.Max = Evaluate("=SUM(allCells)")
.SmallChange = .Max / 100
.LargeChange = .Max / 20
.TickFrequency = .Max / 10
End With
Any thoughts on how to add the sliders to my userform? (All the code is the in form within the attached example.)
Thanks,
Nate
I've created a userform (as mentioned in previous posts) that populates controls dynamically. The following statement doesn't work as it does with textboxes, checkboxes, etc.
Set sliderClass(sliderNum - 1).mySlider = Me.Controls.Add("Forms.Slider.1", "slider" & sliderNum) It throws a "Invalid class string" error, which I believe pertains to the "Forms.Slider.1" portion of the statement, or maybe even everything after the "=" there. The Slider ActiveX Control 6.0 (SP6) is not part of the MSForms Object Library, so I believe I need a different statement to add it to the userform. I'm also considering whether I need to add the reference in the "Tools" menu.
I believe I'm on the right track as Intellisense was prompting me with the properties in the following With block:
With sliderClass(sliderNum - 1).mySlider
.Top = 48 + (sliderNum * 18)
.Width = 204
.Height = 12
.Left = 72
.Value = Range("slider" & sliderNum)
.Max = Evaluate("=SUM(allCells)")
.SmallChange = .Max / 100
.LargeChange = .Max / 20
.TickFrequency = .Max / 10
End With
Any thoughts on how to add the sliders to my userform? (All the code is the in form within the attached example.)
Thanks,
Nate