ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing Ribbon buttons (https://www.excelbanter.com/excel-programming/416416-changing-ribbon-buttons.html)

Brad E.

Changing Ribbon buttons
 
I want my Excel 2007 "Comma Style" and "Percent Style" buttons to work
differently than the default.

I have put the following code in PERSONAL.XLSB.

Sub CommaStyleChange()
Application.CommandBars.FindControl(ID:=397).OnAct ion = MyCommaStyle
End Sub
---------------
Sub MyCommaStyle()
ActiveCell.NumberFormat = "#,##0" 'I don't want decimals or a
leading/trailing space for parenthesis
End Sub

The "Comma Style" button still changes the format to Excel's standard. How
do I get this to work for me everytime I use Excel? Also, since I will want
to do the same for Percent, can someone find the ID number for that?
--
Thank you, Brad E.

Ron de Bruin

Changing Ribbon buttons
 
Hi Brad

You can run your own macro if you click on a Ribbon control but
you must do it in the RibbonX of the file

I have a example in one of the xml example files on this page
http://www.rondebruin.nl/ribbon.htm

See last one (disable-visible-Repurposing)



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Brad E." wrote in message ...
I want my Excel 2007 "Comma Style" and "Percent Style" buttons to work
differently than the default.

I have put the following code in PERSONAL.XLSB.

Sub CommaStyleChange()
Application.CommandBars.FindControl(ID:=397).OnAct ion = MyCommaStyle
End Sub
---------------
Sub MyCommaStyle()
ActiveCell.NumberFormat = "#,##0" 'I don't want decimals or a
leading/trailing space for parenthesis
End Sub

The "Comma Style" button still changes the format to Excel's standard. How
do I get this to work for me everytime I use Excel? Also, since I will want
to do the same for Percent, can someone find the ID number for that?
--
Thank you, Brad E.



All times are GMT +1. The time now is 03:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com