Re: Ensuring the Style control is visible in the toolbars in our embedded Word?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Brian,

However, the Word toolbars seem to come up based on the particular User's
usage of Word... or some other pattern I haven't identified. It would be
nice if I could tell Word to make sure that the style control is visible in
the toolbars, but still otherwise let the Toolbars behave "normally".

Yes, Word saves the user's customizations to the toolbars.

Toolbars are controlled through the CommandBars collection of the Office
object model. In Word, toolbars can be set globally, by template, or by
document. So when you work with a toolbar it's important to set the
CustomizationContext. If customizing a toolbar for just one document, then

application.CustomizationContext = ActiveDocument

Programmatically, the way to approach this would be to get the CommandBar in
question (Dim cb as Office.CommandBar =
Application.CommandBars("Formatting")). Loop through the available controls on
the commandbar and test either the ID or the caption to get the button. If
it's there, check that the .Visible and .Enabled properties are true. If it's
not there, ADD it back on.

I've never investigated how Word's commandbar management "translates" into an
embedded OLE control such as you're using. If things work "normally", then you
should be able to include the toolbar customization as part of the XML
document. Either store the "template" with the customization already in it. OR
put it in with a transform.

In order to "save" this difference in the document, you'd need to remove the
control in question from the Normal.dot template (customization context), then
add it back in, saving the change in the document, itself.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
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 :-)

.



Relevant Pages

  • RE: RibbonX - programatically enable/disable buttons
    ... When you use getVisible, you should keep in mind that even if a control is invisible, the user can still access it via the QAT Customization dialog and execute it via the QAT. ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.office.developer.com.add_ins)
  • Re: Override OnNcHitTest and return HTNOWHERE not working
    ... And ClearType technology in Vista and Win7 seems to me very good as well. ... I confess that I like the old-style classical UI with menus and *customizable* toolbars. ... We had great customizable toolbars in O2K3, and this customization feature was removed in O2K7 for unknown reasons for me. ... I hope that in next Office they resume some good things that we used to have, like *easy customization* of toolbar/ribbons. ...
    (microsoft.public.vc.mfc)
  • Re: CFrameWnd client area rect
    ... There are simple ways to add toolbars and status bars to a dialog-based app; ... I'm displaying it now is by place the window in a formview with the ... "Insert ActiveX control" menu, and then sizing it to the size of the ... Is it possible to know the client area size of a CFrameWnd? ...
    (microsoft.public.vc.mfc)
  • Re: 2 Simple questions
    ... Your customization of the toolbars is stored in Normal.dot. ... I removed a lot of the icons/buttons up top because ... and eventually get a window for a new template. ...
    (microsoft.public.word.customization.menustoolbars)
  • Re: Concerning Icons, Toolbars, and TabViews...
    ... Dolphin's toolbars movable and/or floatable, ... a few tabs appear when dragging the control onto ... Composer) drag a "Card Container.Default view" into your view. ...
    (comp.lang.smalltalk.dolphin)