CustomizationContext - making it stick

D

David Thielen

Hi;

Ok, I don't know why but this works (I hate solutions like this
because you never know if they will continue to work in the future).

For this call (the second one)
Office.CommandBar MainMenuBar = thisApplication.CommandBars["Menu
Bar"];
MainMenuBar.Controls.Add( Office.MsoControlType.msoControlPopup,
Type.Missing, Type.Missing, before, false);

Make sure that 4th parameter is false. If it is, then you can set the
CustomizationContext, create your menu, and if the
CustomizationContext is later changed, your added menu will stay.

I set the CustomizationContext to my template. And when I am done, I
set it back to what it was when my init code started. It all works
great with the false.

thanks - dave

ps - If there is anyone here from MS who can say if this is a
"correct" way to handle this, I would appreciate it.
 
J

Jonathan West

I would do it slightlyu differently. Immediately after setting your menu,
set the Saved property of the template to False, so that the changes are
discarded when the template is closed.
 
D

David Thielen

I do that too - but it is irrelevant to the CustomizationContext as
far as I could tell.

thanks - dave
 
C

Cindy M -WordMVP-

Hi David,
I set the CustomizationContext to my template. And when I am done, I
set it back to what it was when my init code started. It all works
great with the false.
I'm still not clear WHY you bother to reset the CustomizationContext?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 
D

David Thielen

It's a habit from years of systems programming - always restore
settings to how you found them. And if I am co-existing with another
add-in that assumes once it set the context that it would stay (yes
that's a bad assumption), then I don't hurt it.

- dave
 
C

Cindy M -WordMVP-

Hi David,
It's a habit from years of systems programming - always restore
settings to how you found them. And if I am co-existing with another
add-in that assumes once it set the context that it would stay (yes
that's a bad assumption), then I don't hurt it.
I have to admit I've never checked it, but...

I wonder whether the setting doesn't revert to "default" (which would
be Normal.dot) as soon as the procedure that sets it goes out of
scope? My gut feeling is that this is what happens. But maybe you've
seen other behavior that contradicts this?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top