Office Addin changes Word templates and prompts to save them on ex

N

NinuX

Hi,

I have an Office add-in which runs in Word, Excel, powerpoint and outlook

It adds a menu and a toolbar to the application

In Word, when you exit, word promts the user to save the normal.dot and
other templates that were loaded

This only happens when my add-in is installed

I have found various articles that mention that this can happen in a badly
behaved add-in which alters normal.dot

I am not doing anything with the templates in my add-in, what possible
reasons could there be for my add-ins to alter Word's templates ? any ideas
on what sorts of things could cause my add-in to be "badly behaved" ?

Thanks
 
P

pavan

In Word, when you add menu/toolbar normal.dot gets modified.
Technically, it becomes dirty. So, you before you close the app, it'll
prompt you for a save of the template. To resolve this you have two
options:

1) Get the referece to normal.dot template and invoke Save() on it,
typically in DocumentBeforeClose event handler or wherever you would
want to. Code must be something like this (i'm typing this out of my
head in c#, pls chk before you copy it):
foreach(Template template in wordApplication.Templates)
{
if (template.Name == "normal.dot")
{
template.Save();
}
}

2) If your toolbars/menu do not get removed upon uninstallation of your
add-in (which typically is the case), then you add menu to another
template, a custom template. Package this with your add-in. Upon
uninstall, the template gets removed and inturn all the toolbars and
menus that you add. for more information chk this post
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=356963&SiteID=1&mode=1&PageID=0

Hope this helps,
Pavan
 
N

NinuX

Pavan, your reply has been very helpful, thanks for explaining it so well

One of our customers loads other templates by running something in the Start
/ Startup menu and unfortunately word prompts him to save all those templates
as well when he clsoes Word with my add-ins installed - any idea why this
might happen ? Would my add-in make ALL templates dirty ?
 
C

Cindy M.

Hi =?Utf-8?B?TmludVg=?=,
One of our customers loads other templates by running something in the Start
/ Startup menu and unfortunately word prompts him to save all those templates
as well when he clsoes Word with my add-ins installed - any idea why this
might happen ? Would my add-in make ALL templates dirty ?
That depends on what your Add-in does...

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

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