Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.
Function AddToolbarButton(Caption As String, _ toolTip As String, macroName As String, _ Optional toolbarName As String = "Standard", _ Optional FaceID As Long = 325) Dim objBar As Office.CommandBar Dim objButton As Office.CommandBarButton Set objBar = ActiveExplorer.CommandBars(toolbarName) Set objButton = objBar.Controls.Add(msoControlButton) 'objBar.ButtonClick With objButton .Caption = Caption .OnAction = macroName .TooltipText = toolTip .FaceID = FaceID .Style = msoButtonIconAndCaption .BeginGroup = True End With End Function Sub maketoolbarbutton() Call AddToolbarButton("My button", "Click here", "callmacro") Call AddToolbarButton("My button 2", "Click here", "callmacro") End Sub [b]'here is I want callmacro to determine which button was clicked [/b] Sub callmacro 'if command button name = some name then 'do something here 'end if end sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.