Hi guys
I am striving to get the scroll bar on my user form.
I compose the form dynamically, it has 1 to 7 frames in it with lots of labels and text boxes. The problem is, when the form has 7 frames, in other words, gets too big, I need a possibility to scroll to get to the buttons, that I have at the bottom of my form. I can add the scrollbar, but it does not function. Can't figure out, what am I doing wrong?
Here is a piece of my code.
1. Create the form:
Dim MetaForm, NewTextBox As Object
Set MetaForm = Application.VBE.ActiveVBProject.VBComponents.Add(3)
2. Add Controls:
Dim NewFrame1 As MSForms.Frame
Dim NewLabel As MSForms.Label
Set NewFrame1 = MetaParList.designer.Controls.Add("Forms.Frame.1")
'Labels and Text Boxes to the Frame
Set NewLabel = NewFrame1.Controls.Add("Forms.Label.1")
Set NewTextBox = NewFrame1.Controls.Add("Forms.TextBox.1")
3. If I use the same logic for adding a scroll bar to the user form, it does not function:
Dim ScrollBar As MSForms.ScrollBar
Set ScrollBar = MetaParList.designer.Controls.Add("Forms.ScrollBar.1")
Does anyone know, what is the way to get it work?