Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-28-2025, 05:32 PM
Guessed's Avatar
Guessed Guessed is offline Ribbon Customization - Gallery vs ComboBox - built-in control split button - highlighting control Windows 10 Ribbon Customization - Gallery vs ComboBox - built-in control split button - highlighting control Office 2016
Expert
Ribbon Customization - Gallery vs ComboBox - built-in control split button - highlighting control
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,181
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default Ribbon Customization - Gallery vs ComboBox - built-in control split button - highlighting control

I have a custom Word Ribbon using a built-in control that doesn't behave the same way as the built-in control. I'm hoping someone might have an idea on how to save an extra click.

So the built-in Ribbon button for Highlighting text behaves like a Combobox. If you click on the left, it highlights the text, if you click on the right arrow, it expands to show various colours that can be selected. Also I can double-click the highlighter to have it remain on so I can drag multiple areas on the page and have highlights applied. Simples!



I can use the GUI to add the button to another ribbon. Happily this works normally and can be exported to show up as:
Code:
<mso:gallery idQ="mso:TextHighlightColorPicker" showInRibbon="false" visible="true"/>
However, the GUI change only works on my machine and doesn't distribute with a template, hence the need for hand-crafted ribbon code.

So, when I create a custom ribbon and add that 'same' code along with the namespace, the Gallery behaviour starts to bite. This means that clicking on the left side expands the colour picker thus requiring another mouse move and a second click that the original control didn't require. Double-click doesn't work either. Bugger!

I've tried variations on my ribbon without success. That code at its simplest is:
Code:
<gallery idMso="TextHighlightColorPicker" showLabel="false" />
Does anyone have a solution to make the Custom ribbon version of the built-in control behave the same way as the GUI-edited ribbon behaves?
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia

Last edited by Guessed; 10-28-2025 at 08:12 PM.
Reply With Quote
  #2  
Old Yesterday, 05:27 AM
Italophile Italophile is offline Ribbon Customization - Gallery vs ComboBox - built-in control split button - highlighting control Windows 11 Ribbon Customization - Gallery vs ComboBox - built-in control split button - highlighting control Office 2021
Expert
 
Join Date: Mar 2022
Posts: 559
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

Not something I've tried before so gave it a whirl.

Added the code below to a new template:
Code:
<customUI  
	xmlns="http://schemas.microsoft.com/office/2009/07/customui" 
    xmlns:mso="http://schemas.microsoft.com/office/2009/07/customui" >
	<ribbon >
		<tabs >
			<tab id="newTab" >
				<group id="newGroup" >
				    <mso:gallery idQ="mso:TextHighlightColorPicker" showInRibbon="false" visible="true"/>
				</group >
			</tab >
		</tabs >
	</ribbon >
</customUI >
Although this results in an error on load the gallery gets added anyway.
Screenshot 2025-10-29 122254.png
EDIT: It is the parameter "showInRibbon="false" " that creates the error

The top half of the button applies the current highlight color, the bottom half displays the standard gallery.
Screenshot 2025-10-29 122341.png
Double clicking also seems to work, but only after displaying the gallery to set the highlight color.
Hope that helps.

EDIT 2: Attached template contains my working example. Although a dotm there is no code.
Attached Files
File Type: dotm Guessed Test.dotm (15.1 KB, 1 views)

Last edited by Italophile; Yesterday at 11:30 AM. Reason: Add example template
Reply With Quote
  #3  
Old Yesterday, 10:23 AM
Charles Kenyon Charles Kenyon is offline Ribbon Customization - Gallery vs ComboBox - built-in control split button - highlighting control Windows 11 Ribbon Customization - Gallery vs ComboBox - built-in control split button - highlighting control Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,552
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Quote:
Added the code below to a new template:
Code:
<customUI  
     xmlns="http://schemas.microsoft.com/office/2009/07/customui" 
    xmlns:mso="http://schemas.microsoft.com/office/2009/07/customui" >
    <ribbon >
        <tabs >
            <tab id="newTab" >
                <group id="newGroup" >
                    <mso:gallery idQ="mso:TextHighlightColorPicker" showInRibbon="false" visible="true"/>
                </group >
            </tab >
        </tabs >
    </ribbon >
 </customUI >
It has been a while since I dabbled in Ribbon modification. Decided to give it a try, too.

When I added the code for the tab to one of my custom ribbon templates OfficeRibbonEditor's validate generated:
'mso' is an undeclared prefix. Line 257, position 10.

When run in Word, I get a similar error message:

The entire customization fails.

Then I tried a clean dotx template with your full code. (attached)
I get the same error message as you, but the custom tab does not show up so no access to the button/menu.

I would be tempted to try writing it in a .dotm with a custom split-button menu and callbacks, but that is a lot more work and would require that the client give macro permission.


P.S. Even though this is not vba, it occurs to me that it would probably be better in the vba forum. I can move it if others agree.
Attached Files
File Type: dotx RibbonTest.dotx (42.9 KB, 0 views)
Reply With Quote
  #4  
Old Yesterday, 11:05 AM
Charles Kenyon Charles Kenyon is offline Ribbon Customization - Gallery vs ComboBox - built-in control split button - highlighting control Windows 11 Ribbon Customization - Gallery vs ComboBox - built-in control split button - highlighting control Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,552
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Cool

I then tried the following:
Code:
<customUI  
    xmlns="http://schemas.microsoft.com/office/2009/07/customui" 
    xmlns:mso="http://schemas.microsoft.com/office/2009/07/customui" >
    <ribbon >
        <tabs >
            <tab id="newTab" label="New Tab">
                <group id="newGroup" label="Highlight">
                    <gallery idMso="TextHighlightColorPicker" showLabel="false" />
                </group >
            </tab >
        </tabs >
    </ribbon >
</customUI >
That displayed the ribbon tab(after the error message), with an original size button in the group.
Like your original try, there was no left/right dichotomy; both sides ended up displaying the drop-down gallery.

Also tried:
Code:
<customUI  
    xmlns="http://schemas.microsoft.com/office/2009/07/customui" 
    xmlns:mso="http://schemas.microsoft.com/office/2009/07/customui" >
    <ribbon >
        <tabs >
            <tab id="newTab" label="New Tab">
                <group id="newGroup" >
                    <mso:gallery idQ="mso:TextHighlightColorPicker" 
                        showInRibbon="false" 
                        size="normal"
                        visible="true"/>
                </group >
            </tab >
        </tabs >
    </ribbon >
</customUI >
Same result.


I tried adding the split button control using the UI and ended up with something that worked fine.
00 deleteme 1.png
Reply With Quote
  #5  
Old Yesterday, 03:55 PM
Guessed's Avatar
Guessed Guessed is offline Ribbon Customization - Gallery vs ComboBox - built-in control split button - highlighting control Windows 10 Ribbon Customization - Gallery vs ComboBox - built-in control split button - highlighting control Office 2016
Expert
Ribbon Customization - Gallery vs ComboBox - built-in control split button - highlighting control
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,181
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Thanks for testing this guys.

Italophile, I played with your template and didn't see the tab so I customized the code a little bit to get it showing but I still didn't see the behaviour that I was hoping for. At one stage the file opened with double-click working but then I couldn't reproduce that again. Does this version of the customui code work on your machine?
Code:
<customUI  
	xmlns="http://schemas.microsoft.com/office/2009/07/customui" 
    xmlns:mso="http://schemas.microsoft.com/office/2009/07/customui" >
	<ribbon>
		<tabs>
			<tab id="newTab" label="Hilite Test" keytip="H" insertBeforeMso="TabHome">
				<group id="newGroup" label="Test" >
				    <mso:gallery idQ="mso:TextHighlightColorPicker" showInRibbon="false" visible="true" size="large" />
				</group >
			</tab >
		</tabs>
	</ribbon>
</customUI>
Attached Files
File Type: dotx HighlightRibbon.dotx (13.8 KB, 1 views)
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #6  
Old Yesterday, 06:50 PM
Charles Kenyon Charles Kenyon is offline Ribbon Customization - Gallery vs ComboBox - built-in control split button - highlighting control Windows 11 Ribbon Customization - Gallery vs ComboBox - built-in control split button - highlighting control Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,552
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Quote:
Originally Posted by Guessed View Post
Thanks for testing this guys.

Italophile, I played with your template and didn't see the tab so I customized the code a little bit to get it showing but I still didn't see the behaviour that I was hoping for. At one stage the file opened with double-click working but then I couldn't reproduce that again. Does this version of the customui code work on your machine?
Code:
<customUI  
    xmlns="http://schemas.microsoft.com/office/2009/07/customui" 
    xmlns:mso="http://schemas.microsoft.com/office/2009/07/customui" >
    <ribbon>
        <tabs>
            <tab id="newTab" label="Hilite Test" keytip="H" insertBeforeMso="TabHome">
                <group id="newGroup" label="Test" >
                    <mso:gallery idQ="mso:TextHighlightColorPicker" showInRibbon="false" visible="true" size="large" />
                </group >
            </tab >
        </tabs>
    </ribbon>
</customUI>

I got it to load when in startup folder. Same error message.
Button is not splitbutton. Full size.


Would it be sufficient to put it on the QAT?
When placed there...
  • with text selected, a single click on the left side highlights the text in current color (starts out with yellow)
  • with no text selected, after a single click on the left, you can select text and it will be highlighted (like double-click on ribbon)
  • if you click on the right side, you get the gallery
You can add this to your template directly in the UI.
The command is "Text Highlighting Color."

Last edited by Charles Kenyon; Today at 01:09 AM.
Reply With Quote
  #7  
Old Yesterday, 07:25 PM
Guessed's Avatar
Guessed Guessed is offline Ribbon Customization - Gallery vs ComboBox - built-in control split button - highlighting control Windows 10 Ribbon Customization - Gallery vs ComboBox - built-in control split button - highlighting control Office 2016
Expert
Ribbon Customization - Gallery vs ComboBox - built-in control split button - highlighting control
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,181
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Thanks for the suggestion Charles

I hadn't considered adding it to the QAT but the templates do already have a few QAT buttons already so one more would be a subtle alternative that gives easy access to those attentive users.

I note that using the double click makes the GUI added versions show the command is active to allow multi-apply. The Ribbon-code added version doesn't show the active indicator.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #8  
Old Today, 04:48 AM
Italophile Italophile is offline Ribbon Customization - Gallery vs ComboBox - built-in control split button - highlighting control Windows 11 Ribbon Customization - Gallery vs ComboBox - built-in control split button - highlighting control Office 2021
Expert
 
Join Date: Mar 2022
Posts: 559
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

Quote:
Originally Posted by Guessed View Post
Thanks for testing this guys.

Italophile, I played with your template and didn't see the tab so I customized the code a little bit to get it showing but I still didn't see the behaviour that I was hoping for. At one stage the file opened with double-click working but then I couldn't reproduce that again. Does this version of the customui code work on your machine?
Code:
<customUI  
	xmlns="http://schemas.microsoft.com/office/2009/07/customui" 
    xmlns:mso="http://schemas.microsoft.com/office/2009/07/customui" >
	<ribbon>
		<tabs>
			<tab id="newTab" label="Hilite Test" keytip="H" insertBeforeMso="TabHome">
				<group id="newGroup" label="Test" >
				    <mso:gallery idQ="mso:TextHighlightColorPicker" showInRibbon="false" visible="true" size="large" />
				</group >
			</tab >
		</tabs>
	</ribbon>
</customUI>
Yes that works as per your testing. As I previously noted "showInRibbon="false" " needs to be deleted to get rid of the on load error.

I think in my initial testing Word had got itself confused and resurrected the tab that I added via the GUI so that I could examine the RibbonX. Subsequent testing gives the same results as you get.

The standard ribbon uses several controls that cannot be implemented via RibbonX, and this is one of those.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
AutoTextList field or Building Blocks Gallery Content Control WordExperto Word VBA 4 02-02-2024 06:24 AM
How to reset building block gallery content control ericliu24 Word VBA 6 04-15-2022 06:16 AM
Reference a Building block gallery control from another Field and insert text using If logic Flynny Word VBA 3 07-30-2018 08:34 PM
Gallery Content control and protect document DarrenOakey Word 2 08-13-2015 04:56 AM
How-to: Add a quickpart, field or Building Block Gallery Content Control based on a UserForm HighSierra Word VBA 0 05-06-2015 08:20 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:11 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft