Example

This example creates a new toolbar called Demo. It has two buttons, one labelled "About" that displays the Reflection About box, and a second one labelled "Say Hi" that runs the Hi macro that displays a message. ShowToolbar is used to display the new toolbar. SetToolbarPosition and SetToolbar Mode are used to place the new toolbar immediately below the existing toolbar. The line continuation character (an underscore preceded by a space) is used to break up long lines.

Sub ToolbarExample()

 With Session

  .NewToolbar "Demo"

  .DefineToolbarButton "Demo", 1, False, "", 0, "", 0, "About", _

     "", "", "AboutReflectionDlg "

  .DefineToolbarButton "Demo", 3, False, "", 0, "", 0, "Say Hi", _

     "", "", "RunMacro ""Hi"","""" "

  .ShowToolbar "Demo", True

  .SetToolbarMode "Demo", rcTopBar

  .SetToolbarPosition "Demo", 0, 26, 816, 28

 End With

End Sub

 

'Here's the macro called by the second button

Sub Hi()

 MsgBox "Hi"

End Sub