Multiple Outlook Add-in problem

  • Thread starter Thread starter nf
  • Start date Start date
N

nf

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("Menu 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.msoControlPopup,
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
 
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.
 
Back
Top