how can I add a custom Button to the outlook tool bar and make it shell my app?
Printable View
how can I add a custom Button to the outlook tool bar and make it shell my app?
What I know: BUT its not the full answer.
Adding a button to Outlook is not as easy as to Word, Excel and PowerPoint, as the “CommandBar” object doesn’t exist in the same way. Instead, the following method has been used successfully – unfortunately this has to be done manually by each user.
· Right click on the toolbar, and choose customise (or View menu, Toolbars, Customise).
· On the Commands tab, drag and drop a button to the tool bar at the top of the screen.
· With the new button on the toolbar still selected, choose "Modify Selection".
· Change the Name to "Registered Files" (or "Testing" or "Another Button").
· In Modify Selection, "Change Button Image", and choose one of the pictures available.
· In Modify Selection, select "Default Style". Close the Customise window.
· In Modify Selection, select Assign HyperLink, select Open, then browse to the application required.
Other techniques are available, for example:
· Using an Outlook Add-In allows an external application (.DLL) to register itself with Outlook, and to be called when Outlook starts. Once the correct technique is found (!), this should be able to add a button.
· The Virus checkers have tended to add themselves as a .DLL, using the MS-Mail technique. See the registry entry:
Hkey_Local_Machine\Software\Microsoft\Exchange\Client\Extensions
· Posible code for button adding:
VB Code:
Dim oOutlook As Object Dim MyBar As CommandBar Dim WithEvents MyButton As Office.CommandBarButton Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As Object, custom() As Variant) On Error GoTo ErrHandler Set oOutlook = Application.ActiveExplorer Set MyBar = oOutlook.CommandBars.Add(Name:="MYBAR", Position:=msoBarTop, Temporary:=True) Set MyButton = MyBar.Controls.Add(1) MyBar.Visible = True With MyButton .Caption = "THE BUTTON" .Style = msoButtonCaption .Visible = True End With MsgBox "loaded" Exit Sub ErrHandler: MsgBox Err.Description & " : " & Err.Number Set oOutlook = Nothing Set MyButton = Nothing End Sub Private Sub AddinInstance_OnDisconnection(ByVal RemoveMode As AddInDesignerObjects.ext_DisconnectMode, custom() As Variant) On Error Resume Next MyButton.Delete Set MyButton = Nothing Set oOutlook = Nothing End Sub Private Sub MyButton_Click(ByVal Ctrl As Office.CommandBarButton, CancelDefault As Boolean) MsgBox "eureka!" End Sub