New ribbon in Word 2007

F

Frédéric Laurent

Hello,

I created a simple .docm file (doc with macros) in Word 2007. I have a
"Hello world" marco in it.

The only thing I want is to display a new tab in the existing ribbon
with a simple button whent I click on it it displays... Hello World.

To do so, I created a macro in VBA, just like I always did it since
Word 97.

I created a file "customUI.xml" I inserted int the "zip-doc" file (in
the sub directory "customUI")

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">

<ribbon startFromScratch="False">
<tabs>
<tab id="CustomTab" label="My new tab here" visible="1">
<group id="SimpleControls" label="A group of simple
controls here" visible="1">
<button id="Button1" size="large" label="A button here"
visible="1"
onAction="Module1.HelloWorld" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>

I changed the .rels file to have :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships
xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId3"
Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties"
Target="docProps/app.xml"/><Relationship Id="rId2"
Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"
Target="docProps/core.xml"/><Relationship Id="rId1"
Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
Target="word/document.xml"/><Relationship Id="rId4"
Type="http://schemas.microsoft.com/office/2006/relationships/ui/extensibility"
Target="customUI/customUI.xml" />
</Relationships>

But when I open the document, I only have this security alert about the
macro inside.
I can't see a tab in the ribbon.

Any expert in tabs and other ribbons in word 2007 could help me to
perform what it seems a simple task?

Thank you very much!!!

FL
 
F

Frédéric Laurent

Or could someone send me a simple sample of a working new tab on the
ribbon calling a macro.

This really greate person can send me such a file to ipp_flaurent
--at-- yahoo.ca

Thank you in advance!

Yours,

FL
 
D

Doug Robbins - Word MVP

Try asking in microsoft.public.word.programming.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
P

Patrick Schmid

Hi Frederic,

Let me try to help you. Sorry that I didn't see your message earlier.
I just tried what you did and it works here. I would make the following
two modifications to your RibbonX code:
a) delete the blank line between customUI and ribbon
b) get rid of the startFromScratch attribute of ribbon, and just make
that be <ribbon>

I copied the code from your rel-file and added it to one I had here. I
created the sub-directory and put the customUI.xml file there, and then
zipped everything up. The button displays perfectly.
You should check that your docm file is in a trusted location. That
means in a trusted location specifically designated in Word Options,
Trust Center, Trust Center Settings, Trusted Locations.
I put my docm file on the desktop and it worked fine from there.

I hope this helps. If not, ask again here. Also, subscribe to my blog on
my website. I am blogging on RibbonX and ribbon customization.

Patrick Schmid
 

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