简体   繁体   中英

Outlook 2007 Add In. adding menu every time i debug the application in VS2008

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?

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);
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM