MSWord add-in and Normal.dot file

V

Vasily Pavlik

Hi, all.
I created MSWord add-in. It creates a new toolbar with several buttons and
handles events from these buttons.

This add-in based on code from MSDN article.
Everything works fine. Add-in is loaded. Toolbar is being created. Events
from buttons are handled.

But, there is a problem with Normal.dot file. The following actions are
performed:
1. winword.exe started without any document (empty document didplayed).
-> Toolbar appears. Everything's ok.
2. Second instance of winword.exe started from Explorer or any other apps
with .doc file passed as parameter.
-> Toolbar in new window is created. Everything works fine.
3. User tries to close the second window.
-> Messagebox "The file Normal.dot is used by another app or user" appears.
After closing that message box the second window of MSWord is closed
correctly.

All methods of my add-in, such as OnDisconnection() or OnBeginShutdown() are
called AFTER the message box appears.

I'm not sure, but it looks like MSWord desires to store some information
about my toolbar in Normal.dot. Or maybe it wants to store my event handler
data. When I turn off all my DispEventUnadvise() calls, then this error
doesn't appear.

Another problem is in absence of appropiate documentation on this problem. I
didn't find any clear documents to read about MSWord add-ins programming.
All documents contain only base actions, which should be performed to create
and manage toolbars in Word.

Could anyone help me with this problem, please ?

Thanks in advance.
 
C

Cindy M -WordMVP-

Hi Vasily,
I'm not sure, but it looks like MSWord desires to store some information
about my toolbar in Normal.dot.
Do you explicitly set CustomizationContext (look it up in the Word OM
Help) when creating your toolbars? If not, try doing that, setting it to
the current document.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
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 :)
 
V

Vasily Pavlik

Hi Vasily,

Do you explicitly set CustomizationContext (look it up in the Word OM
Help) when creating your toolbars? If not, try doing that, setting it to
the current document.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
Yes. I changed CustomizationContext. But maybe I did something wrong.
Could you show me correct code how to do this, please ?
And what is a "Word OM Help" ? Word Object Model Help ?
I'm new in Word programming, so I could not know about trivial things, sorry
:)

Best wishes
Vasily Pavlik
 

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