Hi everyone,
In PowerPoint, how do I link the scrollbar to buttons? For example, my
buttons won't fit on one slide, so I need to create a scroll bar which when
the user scrolls across, the other buttons appear.
Let me see if I'm picturing this right.
You have a slide with buttons on it. Lots of buttons, more than will fit on
the slide so some of them are off-screen when you view the presentation in
slideshow view.
You want a scrollbar on the slide so the user can scroll the buttons back and
forth, bringing the ones that were off-slide onto the slide and some of the
ones that were on the slide would scroll off.
Something like that?
You'd need to draw a scrollbar with the Scroll Bar control in the VB toolbox.
You'd then add code to the scrollbar's Change event (doubleclick the scrollbar
to go right to it).
The scrollbox's .Value property will tell you the position of the scrollbar's
"thumb":
MsgBox Me.Shapes("Scrollbar1").OLEFormat.Object.Value
By default, this is on a scale from 0 to 32767 but you can rightclick the
scrollbar, choose Properties and set the Max value to anything you like.
From there you'll need to do the math to work out which of the buttons need to
be moved left/right and by how much.
If the buttons are all of the same object type and are the only shapes of that
type on the slide, you can do this in a simple loop. If this is in the
scrollbar's change event:
Dim oSh as Shape
Dim Increment as Single
' calculate how much, neg or pos, to move the shapes and store it in Increment
Increment = 100 (arbitrarily)
For Each oSh in Me.Shapes
If oSh.Type = (whatevertype we're looking for) Then
oSh.Left = oSh.Left + Increment
End If
Next
Once you're done moving the shapes, you'll need to go to the slide in order to
refresh the view.
ActiveWindow.View.GotoSlide (Me.SlideIndex)
That should get you started, I think.