Ribbon assistance: How to get customUI14.xml "into" workbook file? Why subs specified in ribbon xml not firing?

OaklandJim

Board Regular
Joined
Nov 29, 2018
Messages
77
Office Version
  1. 2019
Platform
  1. Windows
I hacked my way to understanding the ribbon-related xml inside excel file. Winzip enables me to make a copy of, modify, replace customUI14.xml so I get that. A big realization for me, heheh.

First, I want to build my own customUI14.xml code (or file?) and use VBA to put it into (and remove or replace it) in a specific Excel file, eventually I want sheet-specific ribbons. Anyway, how does that -- interacting with the xml within the Excel file -- work? What might I read?

I DO have the RibbonX Visual Designer installed but cannot figger out how to use it to modify ribbon xml for an existing file? Any good resources?

Second, sooo basic...still cannot get subs to fire from checkbox elements. No ERROR messages so I presume that my subs are "recognized" but they won't do anything.

What simple concept(s) or code modification am I missing. I HAVE read stuff on-line, but often find what I read to be confusing. But this seems basic?

XML:
<!--RibbonX Visual Designer 2.33 for Microsoft Excel CustomUI14 . XML Code produced on 2020/01/01-->
<customUI  xmlns="http://schemas.microsoft.com/office/2009/07/customui" >
    <ribbon >
        <tabs >
            <tab
                id="Tab1"
                label="Primary Tools">
                <group
                    id="group1"
                    label="Utilities"/>
                <group
                    id="group2"
                    label="Sorting">
                    <checkBox
                        id="G1Checkbox1"
                        label="Sort Symbol"
                        getPressed="G1Checkbox1_OnPress"
                        onAction="G1Checkbox1_OnAction"/>
                    <checkBox
                        id="G1Checkbox2"
                        label="Sort Value"
                        getPressed="G1Checkbox2_OnPress"
                        onAction="G1Checkbox2_OnAction"/>
                </group >
            </tab >
        </tabs >
    </ribbon >
</customUI >

Action subs

VBA Code:
Sub G1Checkbox1_OnAction( _
   ByRef control As IRibbonControl, _
   ByRef pressed As Boolean)

    MsgBox "G1Checkbox1_OnAction, Pressed = " & pressed

End Sub


Sub G1Checkbox1_OnPress( _
   ByRef control As IRibbonControl, _
   ByRef pressed As Variant)

    MsgBox "G1Checkbox1_OnPress, Pressed = " & pressed

End Sub


Sub G1Checkbox2_OnAction( _
   ByRef control As IRibbonControl, _
   ByRef pressed As Boolean)

    MsgBox "G1Checkbox2_OnAction, Pressed = " & pressed

End Sub


Sub G1Checkbox2_OnPress( _
   ByRef control As IRibbonControl, _
   ByRef pressed As Variant)

    MsgBox "G1Checkbox2_OnPress, Pressed = " & pressed

End Sub
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

OaklandJim

Board Regular
Joined
Nov 29, 2018
Messages
77
Office Version
  1. 2019
Platform
  1. Windows
Thanks for the response. I do appreciated it. I HAVE read a lot of stuff by RDB, Pope, etc. I'm old. It all left my head spinning. And honestly, I might not know it when I see it (what I need to learn).

I've made some good baby (elder?) steps though by reading and hacking my way down the road to ribbon. I've made it part way there but I'm feeling around in the dark now. There must be a simple reason that I cannot get my sub to fire using a checkbox.

I'll keep trying to find something that tells me how to put ribbon xml (customUI14.xml) into and remove it from a file using vba.

Have a great day!

Jim
 

Watch MrExcel Video

Forum statistics

Threads
1,130,172
Messages
5,640,580
Members
417,151
Latest member
ChickenTenderer

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top