Adding Custom menu items in the File Menu

  • Thread starter Thread starter mookashi
  • Start date Start date
M

mookashi

hi,

is it possible to add my own custom menu items in the File Menu.
Under the File/New menu where we see different types of mailitems,
can i add my own type of menu items

thank
 
The code is actually pretty simple to add a custom menu item:

Dim objCBs As CommandBars, objCBCs As CommandBarControls
Dim objCBP As CommandBarPopup, objCBB As CommandBarButton
Dim intX As Integer

Set objCBs = Application.ActiveExplorer.CommandBars
Set objCBP = objCBs.FindControl(, 30037) 'GET THE New MENU
Set objCBCs = objCBP.Controls
Set objCBB = objCBCs.Add
objCBB.Caption = "My button"

For more information on programming with Outlook Command Bars, see this
great article at MSDN:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnofftalk/html/office05022002.asp
 
hi eric,

thanks for your comment, the code works and as you said the code wa
indeed quite simple.

Now i have a few questions for you:

1)in the solution you provided the following line
Set objCBP = objCBs.FindControl(, 30037) 'GET THE New MENU
from where did you get '30037'?where are they defined?


2)although the command buttons have been formed i need some image
besides the button. at present the code that im using is not workin
for the commandbar buttons i created using the above method. however i
works for my other custom commandbar buttons. this is how im doing it:
Set myButton = objCBCs.Add(msoControlButton)
Clipboard.Clear
Clipboard.SetData myForm.myPicturecontrol.myPicture, vbCFBitmap

With myButton
.BeginGroup = True
.PasteFace
End With

3)Lastly when i open a new inspector by double clicking an item say i
the Inbox or Sent Items folder i need to add some custom menus in th
Action Menu of the Menu Bar. If its the same method as described by yo
before from where do i get the specific number like '30037' for Ne
Menu.


thanks for your cooperatio
 
1) Robert Sparnaaij, another Outlook MVP, has a handy spreadsheet reference
for all Outlook 2003 Command Bar ID's:
http://www.sparnaaij.net/Downloads/.
There is also an add-in for the Outlook 2000/XP VBA IDE add in - CommandBars
Browser (does not work with OL2003):
http://www.siam-consulting.com/Downloads.htm

2) For working with custom button images, here are some excellent
references:

Custom Button Faces in a Managed Code Add-in for the Microsoft Office System
http://msdn.microsoft.com/library/?...ta/html/odc_oftrsmartdocerrors.asp?frame=true

Listing Button Faces in the Command Bar for the Microsoft Office System
http://msdn.microsoft.com/library/d...y/en-us/dno2k3ta/html/odc_listbuttonfaces.asp

Built-In Outlook 2000 Icon ID Map
http://www.outlookexchange.com/articles/toddwalker/BuiltInOLKIcons.asp

3) When you get the CommandBars collection from an Inspector object, it
returns all built-in menus and commandbars (Task Pane, Clipboard, Menu Bar,
Standard toolbar, etc.). If you set a watch on that collection, you can
browse through each CommandBar item in the collection, and keep going deeper
through their Controls (CommandBarControls) collection until you find
individual menu or button items. In this case, the Actions menu has an ID
of 30131.
 
Outlook Spy also exposes the full CommandBars collection in its Explorer and
Inspector dialogs.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Eric Legault said:
1) Robert Sparnaaij, another Outlook MVP, has a handy spreadsheet reference
for all Outlook 2003 Command Bar ID's:
http://www.sparnaaij.net/Downloads/.
There is also an add-in for the Outlook 2000/XP VBA IDE add in - CommandBars
Browser (does not work with OL2003):
http://www.siam-consulting.com/Downloads.htm

2) For working with custom button images, here are some excellent
references:

Custom Button Faces in a Managed Code Add-in for the Microsoft Office Systemhttp://msdn.microsoft.com/library/?url=/library/en-us/dno2k3ta/html/odc_oftrsmartdocerrors.asp?frame=true

Listing Button Faces in the Command Bar for the Microsoft Office System
http://msdn.microsoft.com/library/d...y/en-us/dno2k3ta/html/odc_listbuttonfaces.asp

Built-In Outlook 2000 Icon ID Map
http://www.outlookexchange.com/articles/toddwalker/BuiltInOLKIcons.asp

3) When you get the CommandBars collection from an Inspector object, it
returns all built-in menus and commandbars (Task Pane, Clipboard, Menu Bar,
Standard toolbar, etc.). If you set a watch on that collection, you can
browse through each CommandBar item in the collection, and keep going deeper
through their Controls (CommandBarControls) collection until you find
individual menu or button items. In this case, the Actions menu has an ID
of 30131.
 
Back
Top