Word 2002 Add-in and Templates (".dot")

A

Alke Wiebenga

Hi all,

For starters, I've succesfully developed a .NET add-in voor Word 2002
using Shims and Office XP Interop Assemblies. The add-in is built in
such a way, that it becomes active only when a certain template file is
loaded into Word. The add-in actually does something like this on
startup (mind the seperate lines of execution after step 2!):

1) Add-in is loaded on Word startup
2) Add-in checks for certain template to be loaded
3a) The template is not loaded, the add-in doesn't do anything
3b) The template is loaded into Word, the add-in adds some buttons to a
toolbar belonging to the template.

My problem is as follows:
Word doesn't always seem to load the template in-time for the add-in to
notice that the template is loaded! For example: when I put the
template (the .dot file) into the Office\Startup folder, the add-in
works fine (that is: the add-in notices that the template is loaded and
adds the buttons to the toolbar). However, when I start Word from the
commandline and try to load the template using commandline arguments,
the add-in doesn't add the buttons to the toolbar! It seems to be as if
the template is loaded after the add-in is loaded. Again, this behavior
does not occur when the template is put into the Office\Startup folder.

Can anybody shed some light on this issue?! Am I right and is the
add-in loaded prior to the template when we use the commandline
options?!

Please help because we definitely do not want to put the template file
into the Office\Startup folder, because we wanted to use the template
to distribute the new functionality to specific users on our network,
not to all users.

Thanks in advance,

Alke Wiebenga
 
C

Cindy M.

Hi Alke,

Can you explain more about this template: Is it also supposed to load as
an Addin? Show us an example of the command line you have in mind?
For starters, I've succesfully developed a .NET add-in voor Word 2002
using Shims and Office XP Interop Assemblies. The add-in is built in
such a way, that it becomes active only when a certain template file is
loaded into Word. The add-in actually does something like this on
startup (mind the seperate lines of execution after step 2!):

1) Add-in is loaded on Word startup
2) Add-in checks for certain template to be loaded
3a) The template is not loaded, the add-in doesn't do anything
3b) The template is loaded into Word, the add-in adds some buttons to a
toolbar belonging to the template.

My problem is as follows:
Word doesn't always seem to load the template in-time for the add-in to
notice that the template is loaded! For example: when I put the
template (the .dot file) into the Office\Startup folder, the add-in
works fine (that is: the add-in notices that the template is loaded and
adds the buttons to the toolbar). However, when I start Word from the
commandline and try to load the template using commandline arguments,
the add-in doesn't add the buttons to the toolbar! It seems to be as if
the template is loaded after the add-in is loaded. Again, this behavior
does not occur when the template is put into the Office\Startup folder.

Can anybody shed some light on this issue?! Am I right and is the
add-in loaded prior to the template when we use the commandline
options?!

Please help because we definitely do not want to put the template file
into the Office\Startup folder, because we wanted to use the template
to distribute the new functionality to specific users on our network,
not to all users.

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 :)
 
A

Alke Wiebenga

Hi,

Thanks for the response!

Maybe I should have mentioned that I am creating an add-in for a Citrix
/ Terminal Server environment. The add-in is installed on every
Terminal Server.

The template being loaded doesn't really do anything. It's only use is
to indicate whether or not the add-in should perform some actions (in
this case, add buttons to a toolbar). So if we want certain users to
get the add-in functionality, we just issue the template to certain
users and the add-in does its' magic. So the template is only used as a
"flag" or "marker" to indicate whether or not the add-in should do
anything.

In more detail, the add-in works like this:
- When the add-in starts, it immediately checks whether or not a
specific template is loaded into Word.
- If the template is loaded into Word, the add-in adds buttons to a
toolbar and thus delivers its' functionality to the user.
- If the template isn't (yet) loaded into Word, the add-in will not add
buttons to the toolbar and the user will not get any add-in
functionality.

The isssue at hand is this: when we put the (flag) template into the
Office\Startup folder, the add-in works fine. That is: the buttons are
added each time we start Word.
However, we do not want every user to get the add-in functionality, so
we don't want the template to reside in the Office\Startup folder. So
when we start Word using the commandline parameters for loading a
template, the add-in does not add the buttons to the toolbar.

Commandline: C:\Program Files\Microsoft Office\Office\Winword.exe
/t"mytemplate.dot"

What I think is happening is this:
The add-in is supposed to load after the Word application has started,
when we put the template in the Office\Startup folder, the template is
already loaded when the add-in starts, and we get the desired outcome.
When we start Word using the commandline switches, the add-in loads
prior to the template and does nothing (which is correct by the
add-in's design).

So the real question is: am I right in my statement above or am I
totally missing something?

If I am right, is there another way to get the functionality I want?!

Thanks in advance,

Alke
 
C

Cindy M.

Hi Alke,
The isssue at hand is this: when we put the (flag) template into the
Office\Startup folder, the add-in works fine. That is: the buttons are
added each time we start Word.
However, we do not want every user to get the add-in functionality, so
we don't want the template to reside in the Office\Startup folder. So
when we start Word using the commandline parameters for loading a
template, the add-in does not add the buttons to the toolbar.
Aha. But in a "default" installation, the Office\Startup folder (as well
as the Word\Startup folder, which would be the better location) are both
part of the individual user profile. Perhaps you should look at making
at least one of these folders user-specific.
Commandline: C:\Program Files\Microsoft Office\Office\Winword.exe
/t"mytemplate.dot"
This command line starts a new document based on the template. This is
NOT the same as loading the template as a global addin (what's happening
in the Startup folder). It's completely logical that the new document is
created and loaded AFTER all Addins have loaded.

Rather than the /t"template name" switch, try the /l"add-in path"
switch. This should start Word and loaded the specified template add-in.

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 :)
 
A

Alke Wiebenga

Hi,

Thanks again for the reply. I'm not real sure howto start a ".NET
Add-in" from the commandline. I've tried starting Word and the add-in
using the "/l" parameter but it didn't do anything. I've tried the
"/l"-switch with both the path to the add-in as well as the path and
filename of the COM Shim of the add-in. Neither worked.

I'm running out of ideas...



Cindy M. schreef:
 
C

Cindy M.

Hi Alke,
Thanks again for the reply. I'm not real sure howto start a ".NET
Add-in" from the commandline. I've tried starting Word and the add-in
using the "/l" parameter but it didn't do anything. I've tried the
"/l"-switch with both the path to the add-in as well as the path and
filename of the COM Shim of the add-in. Neither worked.
Not of the COM Add-in, of the TEMPLATE Add-in. When you load a template
globally (for example, by putting it in the Startup folder), Word
considers it to be an Add-in.

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 :)
 
A

Alke Wiebenga

Ah,

Sorry, I didn't know!!!
It's clear to me know, I'll try this!

Thanks!


Cindy M. schreef:
 

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