0

Can anyone pls tell me how to create a button(in CommandBar) like 'New Mail' (with a dropdown list) in Outlook? When one clicks on the button it should do some action and when clicked on the down arrow mark, it should populate a list of items. I am in need of this very much. If anyone know the answer pls let me know.

Thanks in advance!

-Pranav

Georg Fritzsche
  • 97,545
  • 26
  • 194
  • 236
Pranav
  • 1
  • 1
  • 3
  • 1
    Please have a look at my answer to http://stackoverflow.com/questions/7052233/outlook-2010-add-in-how-to-customize-from-to-cc-subject-pane/7054714#7054714 – domke consulting Nov 14 '11 at 11:02

2 Answers2

1

Assuming Outlook<2007, you add a new button to the explorer/inspector via CommandBars.Add("foo", Type:=msoControlDropdown) and add entries to the drop-down via myDropdown.Add("bar"). See also the reference for CommandBarComboBox.
You can't populate it on click though, you have to find other suitable events for that, e.g. Explorer.SelectionChange.

On Outlook >= 2007 you need to customize the ribbon which is a bit more writing work. Customizing the Ribbon in Outlook 2007 is a good introduction into that.

To create a new mail item use myOlApplication.CreateItem(olMailItem) or myMailFolder.Items.Add(), set it up as needed and show it in an inspector via e.g. myMailItem.Display().

Georg Fritzsche
  • 97,545
  • 26
  • 194
  • 236
1

Sound like you are looking for a split button. Unfortunately the API does not expose that. You can hack up a Popup under the button which is a poor attempt of a split button.

76mel
  • 3,993
  • 2
  • 22
  • 21