Scroll event

Occurs when the scroll box is repositioned.

Syntax

For ScrollBar
Private Subobject _Scroll( )

For MultiPage
Private Subobject _Scroll(indexAs Long,
ActionXAs fmScrollAction,
ActionYAs fmScrollAction,
ByValRequestDxAs Single,
ByValRequestDyAs Single,
ByValActualDxAs MSForms.ReturnSingle,
ByValActualDyAs MSForms.ReturnSingle)

For Frame
Private Subobject _Scroll(ActionXAs fmScrollAction,
ActionYAs fmScrollAction,
ByValRequestDxAs Single,
ByValRequestDyAs Single,
ByValActualDxAs MSForms.ReturnSingle,
ByValActualDyAs MSForms.ReturnSingle)

The Scroll event syntax has these parts:

Part Description
object Required. A valid object name.
index Required. The index of the page in a MultiPage associated with this event.
ActionX Required. The action that occurred in the horizontal direction.
ActionY Required. The action that occurred in the vertical direction.
RequestDx Required. The distance, in points, that you want the scroll bar to move in the horizontal direction.
RequestDy Required. The distance, in points, that you want the scroll bar to move in the vertical direction.
ActualDx Required. The distance, in points, that the scroll bar travelled in the horizontal direction.
ActualDy Required. The distance, in points, that the scroll bar travelled in the vertical direction.

Settings

The settings for ActionX and ActionY are:

Constant Value Description
fmScrollActionNoChange 0 No change occurred.
fmScrollActionLineUp 1 A small distance up on a vertical scroll bar; a small distance to the left on a horizontal scroll bar. Movement is equivalent to pressing the up or left arrow keys on the keyboard to move the scroll bar.
fmScrollActionLineDown 2 A small distance down on a vertical scroll bar; a small distance to the right on a horizontal scroll bar. Movement is equivalent to pressing the down or right arrow keys on the keyboard to move the scroll bar.
fmScrollActionPageUp 3 One page up on a vertical scroll bar; one page to the left on a horizontal scroll bar. Movement is equivalent to pressing PAGE UP on the keyboard to move the scroll bar.
fmScrollActionPageDown 4 One page down on a vertical scroll bar; one page to the right on a horizontal scroll bar. Movement is equivalent to pressing PAGE DOWN on the keyboard to move the scroll bar.
fmScrollActionBegin 5 The top of a vertical scroll bar; the left end of a horizontal scroll bar.
fmScrollActionEnd 6 The bottom of a vertical scroll bar; the right end of a horizontal scroll bar.
fmScrollActionPropertyChange 8 The value of either the ScrollTop or the ScrollLeft property changed. The direction and amount of movement depend on which property was changed and on the new property value.
fmScrollActionControlRequest 9 A control asked its container to scroll. The amount of movement depends on the specific control and container involved.
fmScrollActionFocusRequest 10 The user moved to a different control. The amount of movement depends on the placement of the selected control, and generally has the effect of moving the selected control so it is completely visible to the user.

Remarks

The Scroll events associated with a form, Frame, or Page return the following arguments: ActionX, ActionY, ActualX, and ActualY. ActionX and ActionY identify the action that occurred. ActualX and ActualY identify the distance that the scroll box traveled.

The default action is to calculate the new position of the scroll box and then scroll to that position.

You can initiate a Scroll event by issuing a Scroll method for a form, Frame, or Page. Users can generate Scroll events by moving the scroll box.

The Scroll event associated with the stand-alone ScrollBar indicates that the user moved the scroll box in either direction. This event is not initiated when the value of the ScrollBar changes by code or by the user clicking on parts of the ScrollBar other than the scroll box.

See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.