none
RibbonX: Custom Commands in QAT not shown RRS feed

  • Frage

  • Hello,

    I try to create an Excel 2007 Addin with own ribbons. Nearly everything works well. But I dispair of adding a custom control to the QuickAccessToolbar (QAT). My XML-Code looks fine, but Excel doesn't show my buttons. If I declare a custom control in section "documentControls" then my control will shown after I switched to another file and back, not when I open my file. Costom buttons in section "sharesControls" will never shown.

    Here is a sample XML-code:

    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" >
      <ribbon startFromScratch="true">
        <qat>
    	<sharedControls>
    		<control idMso="Italic" screentip="Make it Italic" supertip="Click here to make the selected text italic."/>
    		<button id="rxbtnClose" imageMso="FileClose" screentip="This is Happy" supertip="Click here for a happy message" onAction="rxbtnOpen_click"/>
    	</sharedControls>
    	<documentControls>
    		<control idMso="Bold" screentip="Make it Bold" supertip="Click here to make the selected text bold."/>
    		<button id="rxbtnOpen" imageMso="FileOpen" screentip="This is Happy" supertip="Click here for a happy message" onAction="rxbtnOpen_click"/>
    		<control id="rxbtnHappy" imageMso="HappyFace" />
    	</documentControls>
        </qat>
        <tabs>
          <tab id="tabUser" label="User">
            <group id="groupUser" label="User">
              <button id="rxbtnHappy" label="Be happy" imageMso="HappyFace" size="large" />
            </group>
          </tab>
        </tabs>
      </ribbon>
    </customUI>

    Build-in controls "italic" and "bold" are shown, control "rxbtnClose" never and controls "rxbtnOpen" and "rxbtnHappy" only after switching to and back from an other document.

    Any ideas why?

    Montag, 13. Februar 2012 10:11

Antworten

  • Thanks for reply, Bogdan. My XML code was just a sample to demonstrate the behavior. You're right, it is better just to use only one section: document or shared. I tried your code in Excel 2007 and it behaves like my code. In Excel 2010 it works fine, btw. mine too.

    I figured out that I'm not the only one with this problem. In the book "RibbonX - customizing the Office 2007 Ribbon" from Robert Martin, Ken Puls and Teresa Hennig I found following section:

    "QAT Caveats
    Although the QAT is a great way to customize your working environment, it does seem
    to suffer from a few drawbacks that might be considered bugs in the current build of
    Microsoft Office. And, being the considerate people that we are, we thought we’d men-tion a few of those issues here and help fellow developers avoid unnecessary frustration.
    Inability to Load Controls
    When working with custom controls such as buttons and groups, you will find that
    Excel, Access, and Word sometimes fail to load the controls upon opening the project.
    This is particularly common when using sharedControls. Be assured that this is not a
    fault in your customizations; instead, it can be attributed to a bug that sporadically
    manifests itself. (As with other known bugs, we want to advise you of the situation and
    provide some options that you can consider using pending a fix.)
    One workaround is to refresh the window by either minimizing it and then maxi-mizing it back or by loading and then promptly unloading a blank file on top of the
    window containing the problematic custom UI."

    They are discribing the same behavior I noticed. The workaround helps me to load all my custom buttons. Not nice but it works.

    Montag, 20. Februar 2012 13:42

Alle Antworten

  • Hallo CNX,

    Man sollte in der <sharedControls> Sektion nur idMso Elemente verwenden. Ich verwende nimmer <sharedControls> und <documentControls> in gleichem Add-In. Wenn unbedingt sein sollte, würde ich dann 2 Add-Ins anwenden: ein Add-In für <sharedControls></sharedControls> und es sollte immer geladen sein (also in C:\Users\...\Microsoft\Excel\XLSTART). Das zweite Add-In sollte die <documentControls> Sektion haben. Hier ist was ich getestet habe und auch funktioniert hat:

    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" >

      <ribbon startFromScratch="true">

        <qat>

              <documentControls>

                        <control idMso="Italic" screentip="Make it Italic" supertip="Click here to make the selected text italic."/>

                        <button id="rxbtnClose" imageMso="FileClose" screentip="This is Happy" supertip="Click here for a happy message" onAction="rxbtnOpen_click"/>

                        <control idMso="Bold" screentip="Make it Bold" supertip="Click here to make the selected text bold."/>

                        <button id="rxbtnOpen" imageMso="FileOpen" screentip="This is Happy" supertip="Click here for a happy message" onAction="rxbtnOpen_click"/>

                        <control id="rxbtnHappy" imageMso="HappyFace" />

              </documentControls>

        </qat>

        <tabs>

          <tab id="tabUser" label="User">

            <group id="groupUser" label="User">

              <button id="rxbtnHappy" label="Be happy" imageMso="HappyFace" size="large" />

            </group>

          </tab>

        </tabs>

      </ribbon>

    </customUI>

    Viele Grüße,

    Bogdan


    Ich bin gerne bei den Foren. Es kommt von Herzen. Es wird aber keine implizite oder sonstige Garantie für die geposteten Antworte / Informationen gewährt. Hier auch die Forenregeln.


    Montag, 20. Februar 2012 11:50
  • Thanks for reply, Bogdan. My XML code was just a sample to demonstrate the behavior. You're right, it is better just to use only one section: document or shared. I tried your code in Excel 2007 and it behaves like my code. In Excel 2010 it works fine, btw. mine too.

    I figured out that I'm not the only one with this problem. In the book "RibbonX - customizing the Office 2007 Ribbon" from Robert Martin, Ken Puls and Teresa Hennig I found following section:

    "QAT Caveats
    Although the QAT is a great way to customize your working environment, it does seem
    to suffer from a few drawbacks that might be considered bugs in the current build of
    Microsoft Office. And, being the considerate people that we are, we thought we’d men-tion a few of those issues here and help fellow developers avoid unnecessary frustration.
    Inability to Load Controls
    When working with custom controls such as buttons and groups, you will find that
    Excel, Access, and Word sometimes fail to load the controls upon opening the project.
    This is particularly common when using sharedControls. Be assured that this is not a
    fault in your customizations; instead, it can be attributed to a bug that sporadically
    manifests itself. (As with other known bugs, we want to advise you of the situation and
    provide some options that you can consider using pending a fix.)
    One workaround is to refresh the window by either minimizing it and then maxi-mizing it back or by loading and then promptly unloading a blank file on top of the
    window containing the problematic custom UI."

    They are discribing the same behavior I noticed. The workaround helps me to load all my custom buttons. Not nice but it works.

    Montag, 20. Februar 2012 13:42
  • Hallo CNX,

    danke fuer das weitere Input. Ich wuerde allerdings das letzte Service Pack von Office 2007 installieren:

    http://support.microsoft.com/kb/2526086

    Kann sein dass es das Problem loest.

    Viele Gruesse,

    Bogdan


    Ich bin gerne bei den Foren. Es kommt von Herzen. Es wird aber keine implizite oder sonstige Garantie für die geposteten Antworte / Informationen gewährt. Hier auch die Forenregeln.

    Montag, 20. Februar 2012 15:23
  • All updates including SP3 are allready installed :-(
    Montag, 20. Februar 2012 15:54