Multi-page and Scroll bars
What code have you attached to the scrollbar _Change event? Forgive me if I
am telling you something you already know here, but in case not: When you add
a scroll bar to a user form it does not automatically give you the ability to
scroll the page. It is just an empty control like any other until you tell
it how to respond. So you would need to have code that moves your controls
on the page in synch with the scroll bar. As a quick example you can try
something like this and see what it can do (you need a button on the form,
any location to start with):
Private Sub ScrollBar1_Change()
CommandButton1.Top = (Me.Height - CommandButton1.Height) * _
(ScrollBar1.Value - ScrollBar1.Min) / (ScrollBar1.Max - ScrollBar1.Min)
End Sub
You could potentially iterate through all controls with a For Each
statement. You would need to modify the above so it tracks the control's
start position and does everything relative to that (my simple code always
brings it to the top of the form)
--
- K Dales
"VBA Fun" wrote:
I have a multipage object on a userform. I programatically add a number of
controls. Depending on the number of conrols I add, I want to have the
scrollbars function to allow the user to see all of the controls.
I can make the vertical scroll bar visible and keep it visible...but
regardless of what I do, the scroll bars don't function.
Any advice?
--
VBA Fun
|