Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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! :) |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. :( |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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...muieditor.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. -- __________________________________ HTH Bob "jean grey" wrote in message ... 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. :( |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 "Bob Phillips" wrote: 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...muieditor.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. -- __________________________________ HTH Bob "jean grey" wrote in message ... 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. :( |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "jean grey" wrote in message ... 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 Sorry, you are right of course, I was getting ahead of myself. You should get the CustomUI Editor though, it makes life a little easier. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Need help w using custom image for custom toolbar in Excel 2007 | Excel Programming | |||
2003 - 2007 custom macro and custom button restore. | Excel Discussion (Misc queries) | |||
Excel 2003 Add-in with C# and VSTO 2005 doesn't show custom menu | Excel Programming | |||
How do I show 2007 custom Button Images with transparent backgroun | Excel Programming | |||
How do I get custom views created in Excel 2K to show in Excel 200 | Excel Worksheet Functions |