Discussion:
Toolbar customization Problem
(too old to reply)
Rita
2006-06-15 21:54:02 UTC
Permalink
Hi

I have created a commandbar with 1 commandbarcombo box and it's positioned
at the top of the document.Here is my code for creating a commandbar with
combo

CommandBar oStandardBar = null
oStandardBar =
(CommandBar)oWord.ActiveWindow.Application.CommandBars.Add("WordToolbar",
MsoBarPosition.msoBarTop, oMissing, true);
// Adding commandbar Combo boxes to commandbar
CommandBarComboBox cmbEntity =
(CommandBarComboBox)oWord.ActiveDocument.CommandBars["IAMWordToolbar"].Controls.Add(MsoControlType.msoControlDropdown, oMissing, oMissing, oMissing, true);

I have also set the protection for the toolbar. Code for that is:

oStandardBar.Protection =
Microsoft.Office.Core.MsoBarProtection.msoBarNoResize|
Microsoft.Office.Core.MsoBarProtection.msoBarNoMove |
Microsoft.Office.Core.MsoBarProtection.msoBarNoChangeVisible|
Microsoft.Office.Core.MsoBarProtection.msoBarNoCustomize;

With the above code i'm unable to retain the toolbar in Word since it can be
deleted using Tools > Customize > toolbars > Delete Option.

Is there any way to handle this. Any help on this is highly appreciated..
Shauna Kelly
2006-06-16 10:23:46 UTC
Permalink
Hi Rita

I don't think there is any way you can prevent users from deleting your
commandbar.

What you can do is:

- Ensure that you have set the .CustomizationContext to your own template or
add-in, and make that template or add-in read-only. In this way, the user
may delete the toolbar, but they can't save the deletion.

- Run code to re-create the toolbar whenever the user starts Word (if the
toolbar is in an add-in) or whenever the user opens a document based on your
template (if your toolbar is in a template).

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
Post by Rita
Hi
I have created a commandbar with 1 commandbarcombo box and it's positioned
at the top of the document.Here is my code for creating a commandbar with
combo
CommandBar oStandardBar = null
oStandardBar =
(CommandBar)oWord.ActiveWindow.Application.CommandBars.Add("WordToolbar",
MsoBarPosition.msoBarTop, oMissing, true);
// Adding commandbar Combo boxes to commandbar
CommandBarComboBox cmbEntity =
(CommandBarComboBox)oWord.ActiveDocument.CommandBars["IAMWordToolbar"].Controls.Add(MsoControlType.msoControlDropdown,
oMissing, oMissing, oMissing, true);
oStandardBar.Protection =
Microsoft.Office.Core.MsoBarProtection.msoBarNoResize|
Microsoft.Office.Core.MsoBarProtection.msoBarNoMove |
Microsoft.Office.Core.MsoBarProtection.msoBarNoChangeVisible|
Microsoft.Office.Core.MsoBarProtection.msoBarNoCustomize;
With the above code i'm unable to retain the toolbar in Word since it can be
deleted using Tools > Customize > toolbars > Delete Option.
Is there any way to handle this. Any help on this is highly appreciated..
Klaus Linke
2006-07-11 22:07:37 UTC
Permalink
And maybe think twice about setting "NoChangeVisible"?
Perhaps the user has good reasons for not wanting to see your toolbar (for
the time being).
If (s)he can make it disappear, (s)he may not be tempted to delete it
altogether...

Regards,
Klaus

Loading...