SharedControls - code for Custom UI Editor error to fix

Answered SharedControls - code for Custom UI Editor error to fix

  • Thursday, August 02, 2012 8:58 AM
     
     

    Working on a project in Excel and being new in programming facing difficulties to accomplish the project. The following code gives the error massage. Could you please assist to correct the code? Any help is highly appreciated. 

    Error massage is: 

    The element ‘qat’ in namespace
    http://schemas.microsoft.com/office/2009/07/customui has invalid child element ‘SharedControls’ in namespace

    etc.



    Here is the code:

    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">

    <ribbon>

                <qat>

                      <SharedControls>

                      <control idMso="FilePrintQuick" label="Shared FilePrintQuick"/>

                      <control idMso="FileSave" label="Shared FileSave"/>

                      <control idMso="FileSaveAs" label="Shared FileSaveAs"/>

                      <control idMso="Undo" label="Shared Undo"/>

                      <control idMso="Redo" label="Shared Redo"/>

                      </SharedControls>

                </qat>

          </ribbon>

    </customUI>

All Replies

  • Thursday, August 02, 2012 1:08 PM
     
     

    Beware the xml tags/attributes are case sensitve.

    <sharedControls>

    lower case shared

    This will then take you to the next problem which is the startfromscratch attribute needs to be set.

    <ribbon startFromScratch="true">


    Cheers,

    Andy
    www.andypope.info


  • Sunday, August 05, 2012 7:59 PM
     
     Answered

    Hi Andy

    You are absolutely right, thanks a lot for helping alien in programming.

    Here is the working code

    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">

      <ribbon startFromScratch="true">

                <qat>

                      <sharedControls>

                      <control idMso="PrintPreviewAndPrint" label="Shared PrintPreviewAndPrint "/>

                      <control idMso="FileSave" label="Shared FileSave"/>

                      <control idMso="FileSaveAs" label="Shared FileSaveAs"/>

                      <control idMso="Undo" label="Shared Undo"/>

                      <control idMso="Redo" label="Shared Redo"/>

                      </sharedControls>

                </qat>

      </ribbon>

    </customUI>

    Cheers and thanks again

    P.S.

    One question remains for me not answered.

    Is it possible to have “Customize Quick Access Toolbar” in the header line when workbook is set to open in Full screen mode based on the following VBA?

    Private Sub Workbook_Open()

    Sheets("Main").Select
    Set myRange = ActiveSheet
       Application.ScreenUpdating = False
       Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
       Application.DisplayFormulaBar = False
       Application.DisplayStatusBar = Not Application.DisplayStatusBar
       ActiveWindow.DisplayWorkbookTabs = True

       Dim wbBook As Workbook
       Dim wsSheet As Worksheet

       Set wbBook = ThisWorkbook

       For Each wsSheet In wbBook.Worksheets
          Rem If Not wsSheet.Name = "Blank" Then wsSheet.Activate
             With ActiveWindow
                .DisplayHeadings = False
                .DisplayGridlines = False
                ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, AllowFormattingRows:=True
                ActiveSheet.EnableSelection = xlUnlockedCells
             End With
       Next wsSheet

    myRange.Select

    End Sub

    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Set myRange = ActiveSheet
       Application.ScreenUpdating = False
       Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)"
       Application.DisplayFormulaBar = True
       Application.DisplayStatusBar = True
       ActiveWindow.DisplayWorkbookTabs = True

       Dim wbBook As Workbook
       Dim wsSheet As Worksheet

       Set wbBook = ThisWorkbook


    End Sub


    Regards Gio

  • Monday, August 06, 2012 8:31 AM
     
     Answered

    The QAT is not display in full screen mode.

    You would have to maximize the application instead of using Full screen to retain the QAT


    Cheers,

    Andy
    www.andypope.info

  • Saturday, August 11, 2012 10:08 PM
     
     

    Thanks and Cheers