Wierd--Excel Control on custom ribbon doesn't work!

ACommandLineKindaGuy

Active Member
Joined
May 11, 2002
Messages
378
Office Version
  1. 365
Platform
  1. Windows
I have a custom ribbon with some built in controls for text formatting. Here's an XML snippet:
XML:
<gallery idMso="CellFillColorPicker" showLabel="false"/>
<toggleButton idMso="AlignLeft" showLabel="false"/>
<toggleButton idMso="AlignCenter" showLabel="false"/>
<toggleButton idMso="AlignRight" showLabel="false"/>
<button idMso="IndentDecreaseExcel"/>
<button idMso="IndentIncreaseExcel"/>

The Indent controls don't work when all other text formatting controls do, including controls I haven't shown in the XML snippet, like bold, italics, font size, and so on.

It's easy enough to just replace the built-in indent controls with:
XML:
<button id="customButton7" size="normal" imageMso="IndentDecreaseExcel" onAction="IndentMinus"/>
<button id="customButton8" size="normal" imageMso="IndentIncreaseExcel" onAction="IndentPlus"/>

with the following in VBA:
VBA Code:
Sub IndentPlus(control As IRibbonControl)
With Selection
    .IndentLevel = .IndentLevel + 1
End With
End Sub

Sub IndentMinus(control As IRibbonControl)
With Selection
    .IndentLevel = .IndentLevel - 1
End With
End Sub

But now if I'm in a protected cell, the workaround controls of course are not disabled, whereas the built-in controls are. I suppose I could add an errorhandler to the subs, but the point is, why do I even need to do this workaround?

TIA John
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Forum statistics

Threads
1,224,273
Messages
6,177,636
Members
452,787
Latest member
BeeTH

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
Back
Top