Search code examples
vbatoolbaroutlook-2003

Create an Outlook 2003 toolbar using VBA


In Excel 2003 I can access the collection Application.CommandBars to create custom toolbars using VBA. Is there an equivalent in Outlook 2003?

I am trying to change the labels on buttons of a customer toolbar. In the future I'd like to create the toolbar from scratch.

Cheers, Dave

--Trindaz on Fedang #Outlook-vbas


Solution

  • Ended up solving this one myself. Here's the code if you're interested:

    Dim expExplorer As Outlook.Explorer
    Dim cmbCommandBar As CommandBar
    Dim ctlBarControl As CommandBarControl
    For Each expExplorer In Outlook.Explorers
        For Each cmbCommandBar In expExplorer.CommandBars
            If cmbCommandBar.Name = "name-of-toolbar" Then
                For Each ctlBarControl In cmbCommandBar.Controls
                    If ctlBarControl.Caption = "caption-i-want-to-change" Then
                        ctlBarControl.Caption = "new-caption-text"
                    End If
                Next ctlBarControl
            End If
        Next cmbCommandBar
    Next expExplorer