55275

Word 2010: how to create a drop-down menu in qat (quick access toolbox)

<strong>SHORT:</strong> I would like to add a drop-down menu to the quick access toolbar of any instance of Word 2010 via placing a customized .dotm-file in Word's startup folder. I fail in creating this customized .dotm-file.

<strong>LONG:</strong> I've been writing a little "add-in" for Word 2010, first with VSTO, then figured out problems with the deployment, now with VBA. The add-in should simplify adding my company's logo and legal notice to documents (different combinations of logos & legal notices exist).

In order to allow selection of wished logo and legal notice with as few clicks as possible, I thought about automatically adding a drop-down menu to the quick access toolbar (qat). I want to do this by placing a .dotm-file containing the code for this qat-extension & the logic for the header/footer-setting in the user's Word startup-folder.

I have already succeded in adding such a drop-down menu to the Add-Ins-Ribbon using CustomUI, everything works fine on the code side. Via the menu the user can choose from all presets supplied and headers and footers are added successfully.

Furthermore, I have seen and played with examples that successfully add controls directly to the qat.

If placed in my startup-folder, these examples do a perfect job and the controls defined therein appear on any instance of Word. The way to go is to create a new folder "userCustomization" in the .dotm-document and then create the customUI.xml-file with several restrictions (no custom icons allowed e.g.).

Unfortunately, I was not able to figure out how to implement a drop-down-menu control in the qat. All the examples I found only used "simple" (button) controls and no matter how many times whatsoever I tried wrapping buttons in a tag, i never got it working.

I can on the other hand manually add my ribbon via "qat => add controls" to the qat and .. voilà .. it's there, working exactly as wanted, so i suppose it must be possible. But what I need is to automate this so that our users don't have to do any configuration of the qat.

Help would be very much appreciated! Best regards from Germany, Kurt

This is how the drop-down menu is added to the Add-Ins-tab:

<ribbon> <tabs> <tab idMso="TabAddIns"> <group id="MyGroup" label="WordDesigner" visible="false"> <menu id="myMenu" label="Design einfügen" size="large" image="menulogo"> <menu id="mySubMenu" label="Rechnungswesen" image="icon2"> <button id="MahnUndKlage" label="Mahn- und Klage" image="icon3" onAction="DesignAnwenden"/> <button id="Buchhaltung" label="Buchhaltung" image="icon3" onAction="DesignAnwenden"/> </menu> <button id="Personalabteilung" label="Personalabteilung" image="icon3" onAction="DesignAnwenden"/> <button id="Verkauf" label="Verkauf" image="icon4" onAction="DesignAnwenden"/> <button id="clearHeaderAndFooter" label="Gestaltung entfernen" image="icon5" onAction="DesignAnwenden"/> </menu> </group> </tab> </tabs> </ribbon> </customUI>

Usefull information I found included:

    <li>Greg Maxey on modifying icons in the qat </li> <li>in german, part 18 of an introduction to RibbonX</li> </ul>

    Answer1:

    Alright, some more research has led to some more information ( ... ) and in case anybody else might ever search for a similar question, I'll try to conclude what i got..

      <li>

      1) According to this MS page on the QAT, only Button, ToggleButton and CheckBox are valid items for the QAT in Win7 (Win8 allows some more controls).

      </li> <li>

      Since you can manually add drop-down-menus as well, I thought there had to be some way to do that automatically as well as with buttons, checkboxes and togglebuttons

      </li> <li>

      I could for the life of me not figure out a way to auto-add a drop-down to the QAT by modifying the customUI.xml-file in the userCustomization-Folder of a .dotm-file in startup folder.

      </li> <li>

      There is one other possibility to achieve that goal: Office 2010 uses a file of the type ".officeUI" where it stores each users elements from the QAT (e.g. Word.officeUI). In there, adding the following xml-Element will make sure that, if you have placed the .dotm-file containing your menu in Word's startup folder, it is on load displayed as a drop-down in the QAT:

      <mso:control idQ="x1:myMenu" visible="true"/>

      </li> <li>

      Unfortunatly, enthusiastically adding this xml-Element to the customUI.xml in userCustomization results in .. poof .. no user defined extra icons in the QAT at all (customUI.xml is corrupt).

      </li> </ul>

      Furthermore, a great ressource I stumbled upon yesterday is Andy Pope's Visual Ribbon Editor. You can easily tweak the Ribbon and QAT.

      Answer2:

      I know I'm late to the game, but I found this post via Google and figured you'd appreciate an answer.

      You can create the appearance of a menu through Word's QAT with a little VBA trickery. Basically, create a custom command bar with each "Control" representing a slot on your desired menu. You can use ".BeginGroup" to create a divider line to separate items if you wish. Your menu can go at least a couple levels down, but for complexity's sake, I wouldn't recommend going too deep.

      When your command bar is perfect, create a macro that only displays your command bar as a popup when run:

      Application.CommandBars("My Command Bar").ShowPopup

      Add a shortcut to that macro to the QAT. When you click that shortcut, your command bar will appear as a popup menu at your cursor, which is the desired effect.

      Enjoy!

Recommend

  • Read a file in “chunks” using PHP
  • Leaflet z-index
  • auth.provider is not set to 'password' when user signs-in with email and password
  • Java : How to tint this PNG programmatically?
  • How can I extend PHP DOMElement?
  • cell spacing in div table
  • XSLT foreach repeating nodes to flat
  • How to create a 2D image by rotating 1D vector of numbers around its center element?
  • HttpListener.IsSupported is false on XP SP3
  • How can I run DataNucleus Bytecode Enhancer from SBT?
  • Jquery Knockout: ko.computed() vs classic function?
  • Thread 1: EXC_BAD_ACCESS (code =1 address = 0x0)
  • android google indoor map
  • Unable to install Git-core+svn by MacPorts
  • Insert new calendar with SyncAdapter- Calendar API Android
  • Django simple Captcha “No module named fields” error
  • jQuery ready not fired after rails link_to is clicked
  • How to define and use opencv mat of user type
  • Could not find rake using whenever rails
  • Atlas images wrong size on iPad iOS 9
  • Android fill_parent issue
  • NetLogo BehaviorSpace - Measure runs using reporters
  • Nant, Vault & Windows Integrated Authentication
  • Azure Cloud Service Web Role web pages do not load
  • C# - Serializing and deserializing static member
  • Bug in WPF DataGrid
  • How would I use PHP exceptions to define a redirect?
  • Incrementing object id automatically JS constructor (static method and variable)
  • ActionScript 2 vs ActionScript 3 performance
  • jquery mobile loadPage not working
  • jQuery tmpl and DataLink beta
  • How can I estimate amount of memory left with calling System.gc()?
  • Properly structure and highlight a GtkPopoverMenu using PyGObject
  • Matrix multiplication with MKL
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • Hits per day in Google Big Query
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • File not found error Google Drive API
  • Converting MP3 duration time
  • java string with new operator and a literal