![]() |
Multiple Toolbars being added/Multiple Buttons being added to Mail
Hello,
I am developing an outlook add-in which requires a single toolbar with a single button being added to the MailEditor window. Upon debugging my project the first time, the button is created and all is well. However, after closing outlook and debugging again, a duplicate toolbar is added (with the button). This continues to happen and toolbar after toolbar is added. I manually remove the Add-In and restart Outlook and the buttons are still there, the only way to remove them is by restarting my PC, and it just happens again. How would I go about solving this problem? Thanks |
Multiple Toolbars being added/Multiple Buttons being added to Mail
Always make sure to set the UI you create as temporary, and then delete it
before the relevant Explorer or Inspector closes. -- 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 "Matt" wrote in message ... Hello, I am developing an outlook add-in which requires a single toolbar with a single button being added to the MailEditor window. Upon debugging my project the first time, the button is created and all is well. However, after closing outlook and debugging again, a duplicate toolbar is added (with the button). This continues to happen and toolbar after toolbar is added. I manually remove the Add-In and restart Outlook and the buttons are still there, the only way to remove them is by restarting my PC, and it just happens again. How would I go about solving this problem? Thanks |
Multiple Toolbars being added/Multiple Buttons being added to
I'm fairly new to Outlook programming, how do I do that?
"Ken Slovak - [MVP - Outlook]" wrote: Always make sure to set the UI you create as temporary, and then delete it before the relevant Explorer or Inspector closes. -- 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 "Matt" wrote in message ... Hello, I am developing an outlook add-in which requires a single toolbar with a single button being added to the MailEditor window. Upon debugging my project the first time, the button is created and all is well. However, after closing outlook and debugging again, a duplicate toolbar is added (with the button). This continues to happen and toolbar after toolbar is added. I manually remove the Add-In and restart Outlook and the buttons are still there, the only way to remove them is by restarting my PC, and it just happens again. How would I go about solving this problem? Thanks |
Multiple Toolbars being added/Multiple Buttons being added to
The CommandBars.Add() method has a temporary argument, set it to True if you
create a new CommandBar object. The CommandBarControls.Add() method also has that argument available when you add a new control to a CommandBar (menu/toolbar). Also set that True. That's generally enough, but if for some reason Outlook doesn't correctly close or crashes a belt plus suspenders approach is to handle the Inspector.Close() event on any Inspector you are adding UI to, and the Explorer.Close() event on any Explorer you add UI to. In those event handlers you get your references to the controls and commandbars you added and call their Delete() method to delete them. There's lots of sample code in various languages at www.outlookcode.com that shows handling those Close() events and how to handle adding and removing UI. Take a look there for samples in your language. -- 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 "Matt" wrote in message ... I'm fairly new to Outlook programming, how do I do that? |
Multiple Toolbars being added/Multiple Buttons being added to
My commandbar was set as temporary but the button was not. Is this way correct:
button_1 = CType(newToolBar.Controls.Add(1, 1, Nothing, Nothing, True), Office.CommandBarButton) ? "Ken Slovak - [MVP - Outlook]" wrote: The CommandBars.Add() method has a temporary argument, set it to True if you create a new CommandBar object. The CommandBarControls.Add() method also has that argument available when you add a new control to a CommandBar (menu/toolbar). Also set that True. That's generally enough, but if for some reason Outlook doesn't correctly close or crashes a belt plus suspenders approach is to handle the Inspector.Close() event on any Inspector you are adding UI to, and the Explorer.Close() event on any Explorer you add UI to. In those event handlers you get your references to the controls and commandbars you added and call their Delete() method to delete them. There's lots of sample code in various languages at www.outlookcode.com that shows handling those Close() events and how to handle adding and removing UI. Take a look there for samples in your language. -- 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 "Matt" wrote in message ... I'm fairly new to Outlook programming, how do I do that? |
Multiple Toolbars being added/Multiple Buttons being added to
For optional missing values use System.Reflection.Missing.Value instead of
using Nothing. I usually define a class or global _missing variable object for that. In general, unless you are using a built-in control it's usually better to not specify the ID argument and to supply the missing value for that also. So I'd code that as: button_1 = CType(newToolBar.Controls.Add(1, _missing, _missing, _missing, True), Office.CommandBarButton) Also, when you set the other properties of any button you create make sure to always use a unique Tag property. That prevents the button Click() event from firing as many times as you have open items (Inspectors) or open folder views (Explorers). With a unique Tag the Click() will fire only in that one Inspector or Explorer. -- 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 "Matt" wrote in message ... My commandbar was set as temporary but the button was not. Is this way correct: button_1 = CType(newToolBar.Controls.Add(1, 1, Nothing, Nothing, True), Office.CommandBarButton) ? |
All times are GMT +1. The time now is 06:14 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com