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
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 viamyDropdown.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)
ormyMailFolder.Items.Add()
, set it up as needed and show it in an inspector via e.g.myMailItem.Display()
.