Customize Ribbon UI

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.
 
C

Charles Kenyon

Doesn't have exactly this capacity. However, here are a couple of posts from
earlier today by people who know what they are talking about (unlike me with
Word 2007).

You might want to see Savraj Dhanjal's weekly (Thursday) posts about Ribbon
customization in Jensen Harris's Office UI blog at
http://blogs.msdn.com/jensenh/; for just Savraj's columns, see
http://blogs.msdn.com/jensenh/archive/category/11280.aspx

--
Suzanne S. Barnhill

All you will get in Office 2007 is the Quick Access Toolbar. You can
position it below or above the ribbon and add controls and groups to it.
That's it. Microsoft has made VERY clear that you won't be able to
create your own toolbars.
For a discussion of what you as a user can customize in Office 2007,
see:
http://pschmid.net/blog/2006/05/24/9

Patrick Schmid
--------------
http://pschmid.net

Hope these help you Greg.

--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide




--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
G

Greg Maxey

Charles,

I have read all of that material. Bill Coan seems to think that there
might be a step missing in procedure in the article Customizing the
Office (2007) Ribbon UI fo Developers Part 1 of 2.

Something is wrong as I have tried the procedure a dozen or more times
and continue to end up with a document that Word thinks is corrupt and
contains unreadable content.

Bill thinks that there is a step missing that modifies the Content_Type
file in the zip container. Based on the error message this seems
plausible, but I have not found what that modification needs to be.

Patrick Schmid plans to post an article on his blog for customizing the
Ribbon with VBA. Hopefully it will be detailed enough for beginner VBA
users to sort out.

Thanks.
 

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