The example adds five Button objects to a Toolbar control and also adds two ButtonMenu objects to each Button object. When a ButtonMenu object is clicked, the ButtonMenuClick event is used to determine its behavior. To try the example, place a Toolbar control on a form and paste the code into the Declarations section of the code module.
Option Explicit
Private Sub Form_Load()
Dim i As Integer
Dim btn As Button
' Add five Button objects to the Toolbar control.
For i = 1 To 5
Set btn = Toolbar1.Buttons.Add(Caption:= i, Style:= tbrDropDown)
' Add two ButtonMenu objects to each Button.
btn.ButtonMenus.Add Text:="Help"
btn.ButtonMenus.Add Text:="Options"
Next i
End Sub
Private Sub Toolbar1_ButtonMenuClick(ByVal ButtonMenu As ComctlLib.ButtonMenu)
Select Case ButtonMenu.Index
Case 1
MsgBox "Press the button."
Case 2
MsgBox "Offer some option"
End Select
End Sub