ScrollHeight, ScrollWidth Properties
Applies To
Frame control, Page object, UserForm object.
Description
Specify the height, in points, of the total area that can be viewed by moving the scroll bars on the control, form, or page.
Syntax
object.ScrollHeight [= Single]
object.ScrollWidth [= Single]
The ScrollHeight and ScrollWidth property syntaxes have these parts:
Part | Description |
|
object | Required. A valid object. |
Single | Optional. The height or width of the scrollable region. |
See Also
ScrollBars property, ScrollLeft, ScrollTop properties.
Example
The following example uses a page of a MultiPage as a scrolling region. The user can use the scroll bars on Page2 of the MultiPage to gain access to parts of the page that are not initially displayed.
To use this example, copy this sample code to the Declarations portion of a form. Make sure that the form contains a MultiPage named MultiPage1, and that each page of the MultiPage contains one or more controls.
Note Each page of a MultiPage is unique. Page1 has no scroll bars. Page2 has horizontal and vertical scroll bars.
Private Sub UserForm_Initialize()
MultiPage1.Pages(1).ScrollBars = fmScrollBarsBoth
MultiPage1.Pages(1).KeepScrollBarsVisible = fmScrollBarsNone
MultiPage1.Pages(1).ScrollHeight = 2 * MultiPage1.Height
MultiPage1.Pages(1).ScrollWidth = 2 * MultiPage1.Width
'Set ScrollHeight, ScrollWidth before setting ScrollLeft, ScrollTop
MultiPage1.Pages(1).ScrollLeft = MultiPage1.Width / 2
MultiPage1.Pages(1).ScrollTop = MultiPage1.Height / 2
End Sub