My Custom Tab does not show up in Excel 2007

J

jean grey

Hi everyone. I'm very new in Excel 2007 UI.
I'm about to create a worksheet with a customized tab/ribbon, so I referred
to this link:
http://msdn.microsoft.com/en-us/library/aa338205.aspx
and followed the steps described at the part, "Modifying Office XML Formats
Files to Customize the Ribbon User Interface".
But "My Tab" did not appear from the Ribbon UI.
Did I miss doing anything?

Thanks in advance! :)
 
J

jean grey

To clearly explain how I created the workbook, here are the steps that I
made, based on the MSDN site:

1. I created a new workbook and saved it as "Custom.xlsm"
2. I opened the VB Editor and in "ThisWorkbook", added the ff. code:

Sub MyButtonMacro(ByVal ControlID As IRibbonControl)
Msgbox("Hello world")
End Sub

3. I saved the worksheet.
4. At my own specified folder, I created a folder, "customUI".
5. Under the "customUI" folder, I created an xml file called "customUI.xml"
having the ff. code:

<?xml version="1.0" encoding="utf-8" ?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="true">
<tabs>
<tab id=":CustomTab" label="My Tab">
<group id="SimpleControls" label="Sample Group">
<button id="Button1" size="large" label="Large Button"
onAction="ThisWorkbook.MyButtonMacro" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>

6. I renamed "Custom.xlsm" to "Custom.xlsm.zip" to see the contents.
7. I added my "customUI" folder (together with the file under it) into the
zip file, just directly under "Custom.xlsm.zip".
8. I extracted the ".rels" file which is under the "_rels" folder in the zip
file.
9. I modified the ".rels" file to add the ff. xml tag as another item under
the "Relationships" tag:

<Relationships>
....
<Relationship Id="someID"
Type="http://schemas.microsoft.com/office/2006/relationships/ui/extensibility" Target="customUI/customUI.xml" />
</Relationships>

10. I added the ".rels" file back into the zip file, under the "_rels"
folder, overwriting the existing file.
11. I renamed the zip file back into "Custom.xlsm" and opened it.

However, after accomplishing these steps, I did not see "My Tab" at the UI. :(
 
B

Bob Phillips

I couldn't get this method to work I must admit.

First, a file with macros should be saved as xlam not xlsm.

Second, get hold of a copy of the CustonUI Editor,
http://openxmldeveloper.org/articles/customuieditor.aspx. With this, open
the xlam file and plug the XML in there. You can validate the XML for
well-formedness (sic!), and generate callbacks, but mainly it plugs it in
properly.

Then try the xlam in 2007.
 
J

jean grey

I got it working.
First I removed the XML declaration in customUI.xml (the one containing the
XML version, etc.)
Then I specified the location by adding "insertAfterMso="TabHome" at the
"tab" tag so that "My Tab" will appear after "Home".

BTW, xlsm files can also run macros. xlsm's are macro-enabled workbooks,
while xlam's are macro-enabled add-ins, as explain in MSDN:

http://msdn.microsoft.com/en-us/library/aa338205.aspx
 

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