Hi Alex,
Now, I am not familiar with VSTO but I was under the impression that I can attach
a VSTO project to a document or a template.You can do that, yes. But VSTO code can't be loaded as an Add-in from the Startup
folder. It's like VBA code-behind a template or document - it's specific to that
document (or documents attached to the template).
What I would like to do:
1) Assume the user has several MS-Word documents open (only one application instance is loaded)
2) The user clicks on a toolbar button in one of the windows. This "loads" some
"add-in" only for this particular document, all the others are unaffected. If the
user so desires, they can "load" it for the other documents as well.
3) Since the document size is a concern, I cannot have the "add-in" be a part of
the document itself. It has to be external.What I usually recommend (never tried it in production, but have suggested it to
others and it appears to work):
1. Set up an Add-in template in the Startup folder that displays its own toolbar.
You want to do this so because other add-ins might manipulate built-in
menus/toolbars). It has one button: to manage Add-ins
2. Remove everything else from the Startup folder
3. The code in the "manager" template can list all templates in an alternate
"Startup" folder. All COM Add-ins found in the Registry for the user, and for the
machine. It can then take care of loading and unloading them.
You can also have an AutoExec macro in it that takes care of removing anything else
in the Addins collection, when Word starts, although you might need to use OnTime
for this because there's no way to control the order in which things load and new
COM Add-ins will load; existing COM Add-ins might get re-enabled to load
automatically.
The only problem that can crop up is if some other Addin is trying to do the same
thing...
This is part of the reasoning behind the Ribbon introduce in Office 2007. Another
Add-in can't affect what tabs your Add-in adds to the Ribbon. There's also a better
"Add-ins manager" functionality in Office 2007.
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or reply in
the newsgroup and not by e-mail