Brian
2007-08-14 20:12:19 UTC
Hello,
In which event is it most appropriate to create a CommandBar button that
displays information about the currently open document?
A little background on my Add In: VB6 COM add-in written to display and
change a Custom Document Property for any Word document.
Right now, I create my button on the IDTExtensibility2_OnConnection event,
which essentially fires when Word is launched. I then update the caption of
the button to display the custom document property on the following events
raised for the Word Application object:
DocumentChange
DocumentOpen
NewDocument
I am noticing, however, that as users move through documents, in some cases,
the reference to my button seems to go away, and when I try to set the
button's caption property I get an "Object variable or with block not set"
exception.
What is the best practice for creating items in the CommandBar in Word for
an addin whose items could change depending on the document that is opened?
Should I recreated the button on DocumentChange??? That seems like a lot of
overhead (and potentially "screen flickering") just to maintain a reference
to the button...
TIA!!!
Brian
In which event is it most appropriate to create a CommandBar button that
displays information about the currently open document?
A little background on my Add In: VB6 COM add-in written to display and
change a Custom Document Property for any Word document.
Right now, I create my button on the IDTExtensibility2_OnConnection event,
which essentially fires when Word is launched. I then update the caption of
the button to display the custom document property on the following events
raised for the Word Application object:
DocumentChange
DocumentOpen
NewDocument
I am noticing, however, that as users move through documents, in some cases,
the reference to my button seems to go away, and when I try to set the
button's caption property I get an "Object variable or with block not set"
exception.
What is the best practice for creating items in the CommandBar in Word for
an addin whose items could change depending on the document that is opened?
Should I recreated the button on DocumentChange??? That seems like a lot of
overhead (and potentially "screen flickering") just to maintain a reference
to the button...
TIA!!!
Brian