COM addin - CommandBar fires events in multiple addins

K

Keith Tromer

Hi,

I have a series of VBA Addins for PowerPoint. I am in the process of
converting them all to COM add-ins developed in VB6. I am first creating a
template, to handle common functions, registration, menu (commandbar)
creation, error checking, etc...

All seems to be working well... EXCEPT... Clicking on a CommandBarButton in
PPT raises events in all addins. Here is more about how I am handling this.

The template has Add-in designers for 3 versions of PPT these designers
raise events in Class Modules that handle the creation and events from
commandbuttons. All Designers are set to load on Startup and the
CommandBarButtons are set correctly (I think) with onAction="!<ProgID>"

When I edit the template for an additional addin, I change the Program ID,
lots of globals, the menu struction to create, etc...

Here is an example of what happens:
The template has common forms and functions, like an About form for example.
When I click on About from Program1, I get the about from that program AND
THEN the about from Program2. I put a messageBox in Program2's _CLICK event
and show some info... Remember I clicked on Program1|about to get here and
it reports:
ProgramID="Program2"
Ctrl.Onaction="!<Program1.PPT11Connection>"

How can this be? The onaction clearly shows that is should run the
connection module in Program1, but it runs BOTH program1 and Program2.

Any ideas? Any more info needed to help me?

Thanks,
Keith
 
K

Keith Tromer

Ken,

Thanks for the reply. I did eventually figure this out. Is there any
technical articles that state this. It doesn't seem to make sense. Don't
misunderstand, it works fine now and there is really no downside (in my
situation) just want to learn more. If the onaction point's it to a
specific DLL then why would it fire an event in another. This means
(theoretically that someone else can you the same .tag and our buttons could
cause errors in each others apps.

Thanks,

Keith
 
K

Ken Slovak - [MVP - Outlook]

I'm not sure about documentation about this, you could search for it on the
MSDN library, but it's common knowledge in Outlook programming circles. The
same applies when you create any command bar object in multiple places, for
example in Outlook in open items. If you don't assign a unique Tag to each
Inspector's (open item) button then all instances of the button code will
fire in order when any one button is clicked.
 
K

Keith Tromer

Thanks for the info Ken.

Keith


Ken Slovak - said:
I'm not sure about documentation about this, you could search for it on the
MSDN library, but it's common knowledge in Outlook programming circles. The
same applies when you create any command bar object in multiple places, for
example in Outlook in open items. If you don't assign a unique Tag to each
Inspector's (open item) button then all instances of the button code will
fire in order when any one button is clicked.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top