o***@gmail.com
2006-05-03 14:01:48 UTC
Hi,
I've written a COM Word add-in that adds a toolbar on connection and
removes the toolbar on disconnection events.
I've seen this topic already discussed in this group, and I learned
that the best practice is to supply an additional global DOT file that
will contain the toolbar, and the COM addin will simply load/unload
that global template.
This works just fine until I want to change something in the toolbar at
runtime. For example, I'd like to disable (gray) some buttons when
there are no open documents and enable it back again when there is one.
The problem is that such operations modify the global DOT file and the
"save mytemplate.dot?" prompt shows up when the user closes the Word
application.
The first solution is to reset the .Saved flag of the template to True
after each such modification. And it works just fine.
However, it conflicts with the case when the user has legally modified
my toolbar (e.g. added a button to it via Tools->Customize). I wish I
could ban such customization but I obviously can't.
A valid response to such situation would be to ask if the user wants to
save the modified template when the application is shut down, but the
above technique (.Saved=True) interferes with this requirement in many
ways.
Does anybody know a workaround? This should be a common problem, so
there should be the best practice of providing custom toolbars in
add-ins, on this level of detail?
Thanks.
I've written a COM Word add-in that adds a toolbar on connection and
removes the toolbar on disconnection events.
I've seen this topic already discussed in this group, and I learned
that the best practice is to supply an additional global DOT file that
will contain the toolbar, and the COM addin will simply load/unload
that global template.
This works just fine until I want to change something in the toolbar at
runtime. For example, I'd like to disable (gray) some buttons when
there are no open documents and enable it back again when there is one.
The problem is that such operations modify the global DOT file and the
"save mytemplate.dot?" prompt shows up when the user closes the Word
application.
The first solution is to reset the .Saved flag of the template to True
after each such modification. And it works just fine.
However, it conflicts with the case when the user has legally modified
my toolbar (e.g. added a button to it via Tools->Customize). I wish I
could ban such customization but I obviously can't.
A valid response to such situation would be to ask if the user wants to
save the modified template when the application is shut down, but the
above technique (.Saved=True) interferes with this requirement in many
ways.
Does anybody know a workaround? This should be a common problem, so
there should be the best practice of providing custom toolbars in
add-ins, on this level of detail?
Thanks.