Sub AddMenuItem()
Dim ToolsMenu As CommandBarPopup
Dim NewMenuItem As CommandBarButton
Set ToolsMenu = CommandBars(1).FindControl(Id:=30007)
If ToolsMenu Is Nothing Then
MsgBox "Cannot add menu item."
Exit Sub
Else
Set NewMenuItem = ToolsMenu.Controls.Add _
(Type:=msoControlButton)
With NewMenuItem
.Caption = "&Clear"
.FaceId = 348
.OnAction = "yourAction"
.BeginGroup = True
End With
End If
End Sub
|