PROGRAMMING THE RIBBON

J

Joe

Hi

I'm trying to create a ribbon in Excel when a workbook is open.

I got the "Custom UI Editor for Microsoft Office".

And make 2 tests, using an especific Workbook and a new (and saved)
workbook.

I paste the following code, obtained from Internet:

<?xml version="1.0" encoding="utf-8" ?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" >
<ribbon>
<tabs>
<tab id="myTab" label="My Tab">
<group id="group1" label="Group 1">
<button id="myButton" label="My Button"
imageMso="HappyFace" size="large"
onAction="myButton_ClickHandler" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>

And I also paste the following code in a New Module in the workbook:

Sub myButton_ClickHandler(control As IRibbonControl)
MsgBox "MyButton was clicked!"
End Sub

After saving the file in the Custom UI Editor and opening the file in Excel:
nothing happens.

The Ribbon is not created.

The file is in a trusted folder.

Could anyon help me?

Thans in advance.

Joe
 
J

Jim Rech

Your ribbonx is for Excel 2010 so I assume you're using Excel 2010 and have
pasted the xml into the customUI14 node...

Given that, I encountered a problem that may be yours too. After I pasted
your code into the Custom UI editor I found that the editor changed the
second line of the xml-

Should be: <customUI
xmlns="http://schemas.microsoft.com/office/2009/07/customui" >

Was: <customUI
xmlns="<http://schemas.microsoft.com/office/2009/07/customui>" >

As you can see, the editor seems to have inserted extra brackets inside the
inner quotes. Remove them and you should be fine.

Also a tip: In Excel options, Advanced, General section near the bottom,
make sure you have "Show add-in user interface errors" selected. Then Excel
will give you some help finding ribbonx errors.
 
J

Joe

Hi Jim

I've found the mistake.

Thank you for your very important help.

I've learnt with your answer.

Thanks.

Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top