G
Greg Maxey
Posting here as I lack knowledge of a better place and in hopes a
developer type is lurking around.
I am looking for a step by step procedure (that actually works) for
making a simple customization to the Word2007 Ribbon UI. All I want to
do is add my own tab and add a button to that tab that will fire a
macro. I have read and reread the article "Customizing the Office
(2007) Ribbon UI for Developers Part 1 of 2 and tried the procedures
listed there at least a dozen times and every time the resulting
document won't open and generates and error that it is corrupted.
Here is the procedure that I have tried:
I opened an new file and created a macro as shown. I digitally signed
the project.
Sub MyMacro(ByVal control as IRibbonControl)
MsgBox("Hello World")
End Sub
I saved the document as an Open XML Formats file that is macro-enabled
and has the file name extension .docm. i.e., saved as Test.docm
I created a file in Notepad with the following XML markup and saved it
as customUI.xml:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="true">
<tabs>
<tab id="CustomTab" label="My Tab">
<group id="SimpleControls" label="My Group">
<button id="Button1" imageMso="HappyFace" size="large"
label="Large Button"
onAction="ThisDocument.MyMacro" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
I put customUI.xml in a folder on the desktop named customUI
I then add a .zip exention to Test.docm i.e., Test.docm.zip
The next steps says to "double-click the file name to open it for
viewing" Hmm...I don't really follow this part as double-click a file
with a .zip extension doesn't really "open it for viewing." It does
open the WinZip application and I am able to perform the next steps.
I add the customUI folder to the Zip container.
I extract the .rels file to the desktop.
I open the .rels file in the text Notepad
I add the following line between the last <Relationship> element and
the </Relationships> element, and then save and close the file:
<Relationship Id="someID"
Type="http://schemas.microsoft.com/office/2006/relationships
/ui/extensibility" Target="customUI/customUI.xml" />
I drag the _rels folder from the desktop to the Zip container file.
Remove the .zip extension from the container file.
Finally I *try* to open the macro-enabled file in Word 2007 and an
error message is generated indicating the is corrupt and contains
content that cannot be read.
John McGhee in attempting to offer a solution stated that:
1. I had to have a name to go along with "someID." I have no idea
what name to use and the code snippet is copied word for word from the
example in the article.
2. docm files are already zipped so ignore the bit about adding the
..zip extension and open the file in Notepad using WinZip. I don't
follow what he means and unless I add the .zip extension I don't see a
..rels folder in the file container.
I have no idea what I could be doing wrong and hopefully someone can
step me through a precedure that works or perhaps direct me to a group
that may be able to assist.
Thanks.
developer type is lurking around.
I am looking for a step by step procedure (that actually works) for
making a simple customization to the Word2007 Ribbon UI. All I want to
do is add my own tab and add a button to that tab that will fire a
macro. I have read and reread the article "Customizing the Office
(2007) Ribbon UI for Developers Part 1 of 2 and tried the procedures
listed there at least a dozen times and every time the resulting
document won't open and generates and error that it is corrupted.
Here is the procedure that I have tried:
I opened an new file and created a macro as shown. I digitally signed
the project.
Sub MyMacro(ByVal control as IRibbonControl)
MsgBox("Hello World")
End Sub
I saved the document as an Open XML Formats file that is macro-enabled
and has the file name extension .docm. i.e., saved as Test.docm
I created a file in Notepad with the following XML markup and saved it
as customUI.xml:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="true">
<tabs>
<tab id="CustomTab" label="My Tab">
<group id="SimpleControls" label="My Group">
<button id="Button1" imageMso="HappyFace" size="large"
label="Large Button"
onAction="ThisDocument.MyMacro" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
I put customUI.xml in a folder on the desktop named customUI
I then add a .zip exention to Test.docm i.e., Test.docm.zip
The next steps says to "double-click the file name to open it for
viewing" Hmm...I don't really follow this part as double-click a file
with a .zip extension doesn't really "open it for viewing." It does
open the WinZip application and I am able to perform the next steps.
I add the customUI folder to the Zip container.
I extract the .rels file to the desktop.
I open the .rels file in the text Notepad
I add the following line between the last <Relationship> element and
the </Relationships> element, and then save and close the file:
<Relationship Id="someID"
Type="http://schemas.microsoft.com/office/2006/relationships
/ui/extensibility" Target="customUI/customUI.xml" />
I drag the _rels folder from the desktop to the Zip container file.
Remove the .zip extension from the container file.
Finally I *try* to open the macro-enabled file in Word 2007 and an
error message is generated indicating the is corrupt and contains
content that cannot be read.
John McGhee in attempting to offer a solution stated that:
1. I had to have a name to go along with "someID." I have no idea
what name to use and the code snippet is copied word for word from the
example in the article.
2. docm files are already zipped so ignore the bit about adding the
..zip extension and open the file in Notepad using WinZip. I don't
follow what he means and unless I add the .zip extension I don't see a
..rels folder in the file container.
I have no idea what I could be doing wrong and hopefully someone can
step me through a precedure that works or perhaps direct me to a group
that may be able to assist.
Thanks.