Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Multi-page and Scroll bars

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Multi-page and Scroll bars

Thank you for the feedback. I am surprised by the response. I figured that
the scroll bar is a part of the control and not a control itself..a as the
scrollbar was not added by me, but made visible as a property of the page
itself. I don't know if this sheds any additional lighton the issue. I will
look to write code to 'scroll' the contents of the page.

Thanks for your quick reply.
--
VBA Fun


"K Dales" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Multi-page and Scroll bars

Yes, there is a built in scrollbar for the userform (and the multipage
control). K Dales is speaking of the scrollbar control which is different.

Size your multipage (assume multipage1) so you can put all your controls on
the the multipage (on the first page/tab, page index zero). Then select the
bottom the multipage and make the multipage about half its height. (so half
the controls are not visible). Now put this code in the Userform Module:

Private Sub UserForm_Initialize()
MultiPage1.Pages(0).ScrollBars = _
fmScrollBarsVertical
MultiPage1.Pages(0).KeepScrollBarsVisible = _
fmScrollBarsVertical
MultiPage1.Pages(0).ScrollHeight = _
2 * MultiPage1.Height
MultiPage1.Pages(0).ScrollTop = _
MultiPage1.Height / 2
End Sub

Now display the userform and the scrollbar should work.

--
Regards,
Tom Ogilvy


"VBA Fun" .(donotspam) wrote in message
...
Thank you for the feedback. I am surprised by the response. I figured

that
the scroll bar is a part of the control and not a control itself..a as the
scrollbar was not added by me, but made visible as a property of the page
itself. I don't know if this sheds any additional lighton the issue. I

will
look to write code to 'scroll' the contents of the page.

Thanks for your quick reply.
--
VBA Fun


"K Dales" wrote:

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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
scroll bars Cutearmychic Excel Worksheet Functions 1 August 22nd 08 08:53 PM
SCROLL BARS GSB Excel Discussion (Misc queries) 1 September 28th 07 05:03 PM
Scroll bars Tazzy via OfficeKB.com Excel Discussion (Misc queries) 3 December 10th 06 10:28 PM
scroll bars vqthomf Excel Programming 1 February 6th 06 12:11 PM
Scroll bars Embalmer Excel Discussion (Misc queries) 1 December 31st 05 05:05 PM


All times are GMT +1. The time now is 01:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"