Skip to content

SaveStateToString Method

Description

Saves the layout of the CommandBar to a string.

Syntax

Public Function SaveStateToString( _
    ByVal SaveControls As Boolean, _
    ByVal SaveOnlyCustomized As Boolean, _
    Optional ByVal SaveOptions As Boolean = False _
) As String

Parameters

  • SaveControls: If True, the customized layout of the CommandBar will be saved. If False, then only the normal layout of the toolbar is saved with no customization information.

  • SaveOnlyCustomized: If True, only the layout of toolbars whose layout has changed will be saved. This will reduce the file size.

  • SaveOptions: If True, the settings on the Keyboard and Options pages of the Customize dialog will be saved. If False, all settings will not be saved.

Remarks

Some applications have multi-user access. It can be useful to store a layout for each user in a personal file instead of the registry.

Example

Save CommandBar Layout to String and File (Visual Basic)

Saves the CommandBar layout to a string. The string is placed in a file so it can be accessed when the application runs.

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

sFile = "c:\Layout.000"
FreeF = FreeFile
Kill sFile
Open sFile For Binary As #FreeF
Put #FreeF, , CommandBars.SaveStateToString(True, True, True)
Close #FreeF

See Also


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