Thread: [Solved] Excel 2010 Custom Ribbon
View Single Post
 
Old 12-04-2010, 01:33 AM
Kaneto Kaneto is offline Windows 7 Office 2010 (Version 14.0)
Competent Performer
 
Join Date: Nov 2010
Posts: 136
Kaneto is on a distinguished road
Default

The buttons for placing superscript and subscript on the custom ribbon aren't built-in, but you can create them pretty easily with VBA.

First, create a new workbook. You're going to want to save it in c:\users\[username]\AppData\Roaming\Microsoft\Excel\XLSTART. Name it personal.xlsb (an Excel binary workbook).

Next you'll need to access the Developer ribbon.
1. Click the File Menu and choose Options.
2. Click on Customize Ribbon.
3. In the right-hand pane, check the box next to Developer.
4. Click OK.

Now to create the macros.
1. Click on the Developer ribbon.
2. Click on Macros.
3. Enter a name for your macro in the Macro name: box (e.g. Superscript).
4. Click the Create button.
5. For Superscript, enter the following code into the VBA box:
Code:
Sub Superscript()
    With Selection.Font
        .Superscript = True
    End With
End Sub
6. Go back to the Excel window, and repeat steps 2-4 for the Subscript macro.
7. Enter the following code in the VBA box for subscript:
Code:
Sub Subscript()
    With Selection.Font
        .Subscript = True
    End With
End Sub
8. Close the VBA editor and save the Excel file (don't put anything in the cells unless you want them to appear in every new excel file).

Now to add the Quick Access buttons:
1. Click on the File menu and choose Options.
2. Click on Quick Access Toolbar.
3. In the Choose commands from: drop-down, pick Macros
4. Select your Superscript and Subscript macros and Add them.
5. Optional: Change the icons for your buttons by highlighting them in the right-hand pane and clicking the Modify button.
6. Click OK when you are done.

That should do it. Hope this helps.

-SW
Reply With Quote