tags:

views:

32

answers:

1

hi, I am creating an Add In for Outlook 2007 using VS2008. I have created a menu in the toolbar. Every time i am debugging the application in VS its creating another menu item in toolbar.

Like my meni item name is Test. First time i run the application It was showing
File .... Test

Second time
File ... Test Test

and so on..

Whats going on?

A: 

Yes toolbars are persistent unless you set them to temporary. So test to see if there first and then remove it or reuse it !

 try
    {
        commandBar = Application.CommandBars["mytoolbar"];
    }
    catch (ArgumentException e)
    {

    }

    if (commandBar == null)
    {
        commandBar = Application.CommandBars.Add("mytoolbar ", 1, missing, true);
    }
76mel