Page 437 - Microsoft Office Excel 2003 Programming Inside Out
P. 437
Part 5: Manipulating Excel Objects
Creating User Forms
The ScrollBar Control
The ScrollBar control allows you to add a classic Windows scroll bar to your application.
Depending on the value of the Orientation property, your scroll bar will appear to be hori Chapter 19
zontal (fmOrientaionHorizontal) or vertical (fmOrientationVertical).
Note By default, the Orientation property is set to fmOrientationAuto, meaning that the
Visual Basic Editor will automatically select the control’s orientation based on whether the
control is wider than tall (horizontal) or taller than wide (vertical).
Moving the scroll box along the scroll bar changes the Value property of the control. The Min
and Max properties specify the minimum and maximum numbers that will be returned
through the Value property. The Min value will be returned when the scroll box is at the top
of a vertical scroll bar or at the left side of a horizontal scroll bar. The Max property will be
returned when the scroll box is at the bottom of a vertical scroll bar or at the right of a hori
zontal scroll bar.
The LargeChange property specifies how much the scroll box will be moved when the user
clicks in between the scroll box arrow buttons, whereas the SmallChange property specifies
how much the scroll box will be moved when the user clicks the arrow buttons on each end
of the scroll bar.
The Scroll event is fired whenever the scroll box is moved on the scroll bar, but the Change
event is fired whenever the value changes. For all practical purposes, these two events are the
same. The only difference between the two events is that the Scroll event will be triggered
multiple times while the user moves the scroll box around on the scroll bar. The Change event
will be fired only after the user has released the scroll box.
411

