Article ID: 191105
Article Last Modified on 5/12/2003
Private Sub Command1_Click()
' Save the toolbar configuration.
Toolbar1.SaveToolbar "Test", "bar1", "Toolbar1"
Toolbar2.SaveToolbar "Test", "bar2", "Toolbar2"
End Sub
Private Sub Command2_Click()
' Restore the toolbar configuration.
Toolbar1.RestoreToolbar "Test", "bar1", "Toolbar1"
Toolbar2.RestoreToolbar "Test", "bar2", "Toolbar2"
End Sub
Private Sub Command3_Click()
' Customize Toolbar1.
Toolbar1.Customize
End Sub
Private Sub Command4_Click()
' Customize Toolbar2.
Toolbar2.Customize
End Sub
Private Sub Form_Load()
Dim i As Integer
Command1.Caption = "Save Toolbars"
Command2.Caption = "Restore Toolbars"
Command3.Caption = "Customize 1"
Command4.Caption = "Customize 2"
Toolbar2.Align = vbAlignBottom
Toolbar1.ImageList = ImageList1
Toolbar2.ImageList = ImageList2
' Add some buttons to the toolbars.
For i = 1 To 6
Toolbar1.Buttons.Add Caption:=Str(i), Image:=i
Toolbar2.Buttons.Add Caption:=Str(i), Image:=0
' Make the third button a separator.
If i = 3 Then
Toolbar1.Buttons(i).Style = tbrSeparator
Toolbar2.Buttons(i).Style = tbrSeparator
End If
Next i
' Uncomment the following For loop to fix the issue with
' the captions for the buttons on toolbar2 not showing up when
' you restore toolbar2.
'For i = 1 To 6
'Toolbar2.Buttons(i).Image = 1
'Next i
' Uncomment the next two lines to have the Toolbars restore when
' the form loads.
'Timer1.Enabled = True
'Timer1.Interval = 1
End Sub
Private Sub Timer1_Timer()
' This will restore the Toolbars when the form first loads.
Toolbar1.RestoreToolbar "Test", "bar1", "Toolbar1"
Toolbar2.RestoreToolbar "Test", "bar2", "Toolbar2"
Timer1.Enabled = False
End Sub
Keywords: kbbug kbtoolbar kbcomctrls kbpending KB191105