View Single Post
  #2  
Old June 12th 08, 04:45 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Multiple Outlook Add-in problem

If you don't set position the control will be added at the end of the
toolbar no matter how many other addins add their controls to that toolbar.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"nf" wrote in message
...
Hi,

I developed an outlook add-in using VS 2005. The add-in adds a new
menu item (QB) in the Menu Bar by adding a CommanBarPopup to the Menu
Bar.I get a count of all controls in the Menu Bar Command Bar and add
the new menu at position = count + 1. Everything works fine. The
problem occurs when there are multiple add-Ons installed. and those
add-ins also add a new menu item in the menu bar at the end. In such
case only one menu item is displayed. Either mine or the other add-
ons. Both dont get shown at one time. Can anybody please help me.
My code is as follow
Dim objCmdBar As CommandBar =
applicationObject.ActiveExplorer().CommandBars("Me nu Bar")
objCmdBar.Reset()

Dim objCommandBarPopup As CommandBarPopup 'used for adding
the 'QB' Popup menu to main menu bar in outlook
Dim objMainCmdBarControl As CommandBarControl 'used for
adding new controls to 'QB' PopUp Menu


Dim position As Integer

'Add a new pop up menu 'QB' to Menu Bar
Try
objCommandBarPopup = CType(objCmdBar.Controls("QB"),
CommandBarPopup)
Catch ex As SystemException



position = objCmdBar.Controls.Count + 1



objCommandBarPopup =
CType(objCmdBar.Controls.Add(MsoControlType.msoCon trolPopup,
Missing.Value, Missing.Value, position, True), CommandBarPopup)
objCommandBarPopup.Caption = "QB"
End Try

'Adding the CommandBar buttons to the QB Menu
With objCommandBarPopup
.Visible = True
.Tag = "QB"
objMainCmdBarControl
= .Controls.Add(MsoControlType.msoControlButton, Missing.Value,
Missing.Value, Missing.Value, Missing.Value)

Login = CType(objMainCmdBarControl, CommandBarButton)
With Login
.Caption = "Login"
'.Tag = "Login"
.Visible = True
End With
End with


Ads