Table of contents
Collapse the table of content
Expand the table of content

ScrollHeight, ScrollLeft, ScrollTop, ScrollWidth Properties Example

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

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 = _ 

 MultiPage1.Pages(1).ScrollHeight = 2 * _ 
 MultiPage1.Pages(1).ScrollWidth = 2 * _ 

 'Set ScrollHeight, ScrollWidth before setting 
 'ScrollLeft, ScrollTop 
 MultiPage1.Pages(1).ScrollLeft = _ 
 MultiPage1.Width / 2 
 MultiPage1.Pages(1).ScrollTop = _ 
 MultiPage1.Height / 2 
End Sub
© 2018 Microsoft