Phillippe Allen
Posts: 30
Joined: 2005-11-07
|
I have a addin loaded into word. If the user opens a doc, then closes the doc (without closing word). When they try to open another doc (using File->open) an exception is raised. However, subsequent opening of docs is fine. If I dregister the addin, the eception no longer appears. I have some code in the OnAddinModuleCreate and in the OnAddinModulestartupcomplete but the exception appears to be being raised before it gets into these methods. The odd thing is that these methods get called twice ie if I place showmessages in the OnAddinModuleCreate, they get displayed when word opens and then gets displayed again when the 2nd docs gets opened (but only if the first was closed).
Is there some other methods that get called that i need to be aware of so that i can track down the cause of this bug.
This happens in both word2003 and word2000 :-(
Regards
Phil |
|
Dmitry Kostochko
Add-in Express team
Posts: 2887
Joined: 2004-04-05
|
Hi Phillippe,
I would recommend to move your code from the OnCreate event handler to OnAddInInitialize. As to the exception, please make sure it isn't raised in your OnAddinModuleCreate code.
|
|
Phillippe Allen
Posts: 30
Joined: 2005-11-07
|
Dmitry
Firstly I have moved the oncreate code into the oninitialize event.
If I put showmessages in the oncreate and oninitialize events, they are displayed for the first time when word opens. If I follow the steps outlined above, they are not displayed again until after the error occurs (ie the exception message appears and I choose yes when it asks if I wish Word to recover doc). This appears to indicate that the exception is not related to the oncreate event. Just to make sure I wrapped the oninitialize code inside an exception handler which doesnt get triggered. Even weirder, the error occurs if I deregister my addin and install the addin created by your sample code "MyFirstAddin". I know this is set to excel normally but if I change it to support Word only , then the error occurs as well. However, if I install your adxtoys for word addin (after deregistering the MyfirstAddin), then the error doesnt occur.
The MyFirstAddin source code is very basic so I was wondering is there some parameter that i need to set to get it to behave correctly (like the ADXToys addin)? |
|
Dmitry Kostochko
Add-in Express team
Posts: 2887
Joined: 2004-04-05
|
Hi Phillippe,
Unfortunately I can't reproduce the situation by changing MyFirstAddin source code. Please contact me directly by email and send me either your code or MyFirstAddin changed code. Also please remeber to indicate ADX version (including build number).
|
|