G
Gary McGill
Hi,
I'm trying to develop a COM add-in using C# and VS.NET 2003. I'm doing
development under Windows XP and the version of Office on my development
machine is also XP. (Eventually I would like my add-in to work with all
Office versions from 2000 up, but looking over this group it looks like
that'll be a challenge in itself).
Anyway... the problem. I've followed the steps described in the (scant)
documentation available (KB 302901), and have an add-in that adds a new
command button to Word. Actually I've modified it somewhat, so I'm adding my
own command bar but I doubt that's relevant.
It all works fine if I start off with a blank document and click a button on
my command bar - my dialog comes up, and my code adds a new field to the
document. BUT, once I've done this once, all the buttons on my command bar
stop working.
What's even stranger is that if I save my document, re-start Word and open
the document again, the mere fact that I've opened this (contaminated?)
document means that my command bar buttons don't work. Once they stop
working they never start again, no matter what document I have open.
If on the other hand I start Word and DON'T open a contaminated document,
the command bar works fine. It looks like I've created a command bar-killing
document!
At one point I saw Dave's "tech note" about keeping a reference to menu
items you add from your COM add-in so that they don't get GC'd, and figured
maybe that was my problem. But when I added references to my command bar and
to the buttons (and even the event handlers, for good measure) it made no
difference.
I've now spent about 50% of my total development time to date on trying to
get these COM add-in things to work. Most of *that* time was spent trying to
find some decent documentation - and were it not for the "third party"
documentation (thanks, Dave) I'd have given up long before now.
I'll stop now before I rant myself into a lather. Any help gratefully
received.
Gary
I'm trying to develop a COM add-in using C# and VS.NET 2003. I'm doing
development under Windows XP and the version of Office on my development
machine is also XP. (Eventually I would like my add-in to work with all
Office versions from 2000 up, but looking over this group it looks like
that'll be a challenge in itself).
Anyway... the problem. I've followed the steps described in the (scant)
documentation available (KB 302901), and have an add-in that adds a new
command button to Word. Actually I've modified it somewhat, so I'm adding my
own command bar but I doubt that's relevant.
It all works fine if I start off with a blank document and click a button on
my command bar - my dialog comes up, and my code adds a new field to the
document. BUT, once I've done this once, all the buttons on my command bar
stop working.
What's even stranger is that if I save my document, re-start Word and open
the document again, the mere fact that I've opened this (contaminated?)
document means that my command bar buttons don't work. Once they stop
working they never start again, no matter what document I have open.
If on the other hand I start Word and DON'T open a contaminated document,
the command bar works fine. It looks like I've created a command bar-killing
document!
At one point I saw Dave's "tech note" about keeping a reference to menu
items you add from your COM add-in so that they don't get GC'd, and figured
maybe that was my problem. But when I added references to my command bar and
to the buttons (and even the event handlers, for good measure) it made no
difference.
I've now spent about 50% of my total development time to date on trying to
get these COM add-in things to work. Most of *that* time was spent trying to
find some decent documentation - and were it not for the "third party"
documentation (thanks, Dave) I'd have given up long before now.
I'll stop now before I rant myself into a lather. Any help gratefully
received.
Gary