C
Christine
My load-on-demand add-in written in VisualBasic.NET for Word 2003 loads and
unloads cleanly as long as I use the COM Add-in command of the Tools menu to
load and unload it. Consistent with this, the menu associated with my add-in
displays and disappears cleanly when the add-in is loaded and unloaded using
the Tools menu, and, in that situation, when the menu is visible it works.
However, when Word is closed with the add-in in place, then re-started, then
(1) the add-in information is inconsistent; when Word is re-opened, the
add-in's LoadBehavor is 9, "loaded", even though OnConnection was not called;
(2) because, OnConnection was not invoked, the code to build the menu was
not executed,
(3) the menu is visible, apparently a "leftover" from a less-than-clean exit
on the prior shutdown of WOrd. I coded the work-around in OnDisconnection for
the bug described in KBKB230876 - i.e., I re-acquire the menu reference,
assuming that the previous reference has been invalidated before.
In the OnDisconnection code, if I invoke MainMenuBar.FindControl("My Menu
Name"), a value is returned (though the menu doesn't seem to get deleted in
this situation, as it is when the add-in is unloaded normally). However, when
Word is re-started, and the non-functional menu is displayed,
MainMenuBar.FindControl("My Menu Name") does not return a value, as if the
menu is being displayed but is not really included as a CommandBarControl
object included by the Main Menu Bar.
Can anyone shed some light regarding what is going on here, and, in
particular, about a work-around? I can tell users of the add-in to unload
using the Tools menu, but would prefer to provide software that behaves
properly in this situation.
- Christine
unloads cleanly as long as I use the COM Add-in command of the Tools menu to
load and unload it. Consistent with this, the menu associated with my add-in
displays and disappears cleanly when the add-in is loaded and unloaded using
the Tools menu, and, in that situation, when the menu is visible it works.
However, when Word is closed with the add-in in place, then re-started, then
(1) the add-in information is inconsistent; when Word is re-opened, the
add-in's LoadBehavor is 9, "loaded", even though OnConnection was not called;
(2) because, OnConnection was not invoked, the code to build the menu was
not executed,
(3) the menu is visible, apparently a "leftover" from a less-than-clean exit
on the prior shutdown of WOrd. I coded the work-around in OnDisconnection for
the bug described in KBKB230876 - i.e., I re-acquire the menu reference,
assuming that the previous reference has been invalidated before.
In the OnDisconnection code, if I invoke MainMenuBar.FindControl("My Menu
Name"), a value is returned (though the menu doesn't seem to get deleted in
this situation, as it is when the add-in is unloaded normally). However, when
Word is re-started, and the non-functional menu is displayed,
MainMenuBar.FindControl("My Menu Name") does not return a value, as if the
menu is being displayed but is not really included as a CommandBarControl
object included by the Main Menu Bar.
Can anyone shed some light regarding what is going on here, and, in
particular, about a work-around? I can tell users of the add-in to unload
using the Tools menu, but would prefer to provide software that behaves
properly in this situation.
- Christine