Become a Columnist Microsoft Exchange Site Microsoft Support SiteMSDN Exchange Site

   

h
 

Print all Built-In Outlook Menu Items and their associated ID's

Often you want to hide or programatically execute a built-in Outlook menu item. To do this you'll need its unique ID. The code below will automatically display all of the built-in Outlook menus and their associated ID's. Once you know the ID of the built-in CommandBarButton, you can use the FindControls method of the CommandBar or CommandBars object to retrieve that particular menu item.

Code

Dim strIndent

Function Item_Open()
    For Each objCB In Application.ActiveExplorer.CommandBars
        If objCB.Type = 1 And objCB.BuiltIn Then
            PrintIDs objCB
            Exit For
        End If
    Next
End Function

Sub PrintIDs(objCB)
    For Each objCBControl In objCB.Controls
       Item.Body = Item.Body & strIndent & objCBControl.ID & ": " & objCBControl.Caption & vbCrLf
       If objCBControl.Type = 10 Then
           strIndent = strIndent & vbTab
           PrintIDs objCBControl.CommandBar
           If Len(strIndent) > 0 Then strIndent = Left(strIndent, Len(strIndent) - 1)
       End If
    Next
End Sub

Print all Built-In Outlook Menu Items and their associated ID's


Disclaimer: Your use of the information contained in these pages is at your sole risk. All information on these pages is provided "as is", without any warranty, whether express or implied, of its accuracy, completeness, fitness for a particular purpose, title or non-infringement, and none of the third-party products or information mentioned in the work are authored, recommended, supported or guaranteed by Stephen Bryant or Pro Exchange. OutlookExchange.Com, Stephen Bryant and Pro Exchange shall not be liable for any damages you may sustain by using this information, whether direct, indirect, special, incidental or consequential, even if it has been advised of the possibility of such damages.

Copyright Stephen Bryant 2008