You should use an Inspector wrapper class, with a collection of wrappers to
keep them alive. As Inspectors.NewInspector() fires you add the Inspector to
a new wrapper class.
Then each button gets a unique Tag to make sure a click in one Inspector
isn't handled in every Inspector.
You can download sample templates from my Web site in your language of
choice (C#, VB.NET and VB6) at
http://www.slovaktech.com/outlook_2007_templates.htm. The templates are for
Outlook 2007 but they show Inspector and Explorer wrappers and various other
things such as form regions, custom task panes, property pages and so on.
--
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
"-mhd" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
"Michael Bauer [MVP - Outlook]" <(E-Mail Removed)> wrote:
>I don't understand the question. If the button exists, it exists.
It exists on the first inspector but testing for existence when new
inspectors (contacts)
activate I get a false *exists* and never get a get a new button on
secondary inspectors.
If the all inspectors are closed then it works when I open a new one.
This was my original post:
I have a mature application where I use Inspector.Activate event as the
place where I add a Button to a Contact when a contact is opened.
This is the code section I am concerned with...
Set objBar = objInsp.CommandBars.item("Standard")
If objButton Is Nothing Then
Set objButton = objBar.Controls.Add(msoControlButton, , , , True)
It works just fine on the first contact opened but when I open subsequent
contacts while
the first is still open then the "If objButton Is Nothing" test bypasses
adding a new
button.
Is there a better wrapper object or event that I should move my UI creation
code to, or is
there some way to track new inspectors?
-mike