Skip to content

LoadStateFromString Method

Description

Loads the layout of the CommandBar from a string.

Syntax

Public Sub LoadStateFromString( _
    ByVal Profile As String, _
    ByVal RestoreControls As Boolean, _
    Optional ByVal RestoreOptions As Boolean = False, _
    Optional ByVal Silent As Boolean = False _
)

Parameters

  • Profile
    The CommandBar Layout in String format.

  • RestoreControls
    If True, the layout of the controls will be restored. i.e. If the user moves some controls or adds some controls to the toolbar, they will be restored. If False, the position of the controls and any controls added by the user will not be restored.

  • RestoreOptions
    If True, the setting on the Keyboard and Options pages of the Customize dialog will be restored. If False, all settings will be set to the default values.

  • Silent
    If True, no message boxes will be displayed. i.e. The message box that asks for confirmation before the CommandBar layout is reset.

Example

Load the Layout of a CommandBar from a file. The file contains the CommandBars layout saved in String format.

Dim FreeF As Integer, sFile As String, sLayout As String

On Error Resume Next:

    sFile = "c:\Layout.000"
    FreeF = FreeFile
    sLayout = Space(FileLen(sFile))

    Open sFile For Binary As #FreeF
    Get #FreeF, , sLayout
    Close #FreeF

    On Error GoTo 0
    CommandBars.LoadStateFromString sLayout, True

See Also

CommandBarsFrame Control


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.