KeepScrollBarsVisible Property

Applies To

Frame control, Page object, UserForm object.

Description

Specifies whether scroll bars remain visible when not required.

Syntax

object.KeepScrollBarsVisible [= fmScrollBars]

The KeepScrollBarsVisible property syntax has these parts:

Part

Description

object

Required. A valid object.

fmScrollBars

Optional. Where scroll bars are displayed.


Settings

The settings for fmScrollBars are:

Constant

Value

Description

fmScrollBarsNone

0

Displays no scroll bars.

fmScrollBarsHorizontal

1

Displays a horizontal scroll bar.

fmScrollBarsVertical

2

Displays a vertical scroll bar.

fmScrollBarsBoth

3

Displays both a horizontal and a vertical scroll bar (default).


Remarks

If the visible region is large enough to display all the controls on an object such as a Page object or a form, scroll bars are not required. The KeepScrollBarsVisible property determines whether the scroll bars remain visible when they are not required.

If the scroll bars are visible when they are not required, they appear normal in size, and the scroll box fills the entire width or height of the scroll bar.

See Also

ScrollBars property.

Example

The following example uses the ScrollBars and the KeepScrollBarsVisible properties to add scroll bars to a page of a MultiPage and to a Frame. The user chooses an option button that, in turn, specifies a value for KeepScrollBarsVisible.

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.
  • A Frame named Frame1.
  • Four OptionButton controls named OptionButton1 through OptionButton4.
    Private Sub UserForm_Initialize()
        MultiPage1.Pages(0).ScrollBars = fmScrollBarsBoth
        MultiPage1.Pages(0).KeepScrollBarsVisible = fmScrollBarsNone
        
        Frame1.ScrollBars = fmScrollBarsBoth
        Frame1.KeepScrollBarsVisible = fmScrollBarsNone
        
        OptionButton1.Caption = "No scroll bars"
        OptionButton1.Value = True
        OptionButton2.Caption = "Horizontal scroll bars"
        OptionButton3.Caption = "Vertical scroll bars"
        OptionButton4.Caption = "Both scroll bars"
    End Sub
    
    Private Sub OptionButton1_Click()
        MultiPage1.Pages(0).KeepScrollBarsVisible = fmScrollBarsNone
        Frame1.KeepScrollBarsVisible = fmScrollBarsNone
    End Sub
    
    Private Sub OptionButton2_Click()
        MultiPage1.Pages(0).KeepScrollBarsVisible = fmScrollBarsHorizontal
        Frame1.KeepScrollBarsVisible = fmScrollBarsHorizontal
    End Sub
    
    Private Sub OptionButton3_Click()
        MultiPage1.Pages(0).KeepScrollBarsVisible = fmScrollBarsVertical
        Frame1.KeepScrollBarsVisible = fmScrollBarsVertical
    End Sub
    
    Private Sub OptionButton4_Click()
        MultiPage1.Pages(0).KeepScrollBarsVisible = fmScrollBarsBoth
        Frame1.KeepScrollBarsVisible = fmScrollBarsBoth
    End Sub