PC Review


Reply
Thread Tools Rate Thread

Custom Ribbon example in Walkenbach's "Excel 2007 Power Programming with VBA"

 
 
Greg Lovern
Guest
Posts: n/a
 
      16th Sep 2007
I'm trying to do the custom ribbon example on pages 736 - 739 of John
Walkenbach's "Excel 2007 Power Programming with VBA".

I haven't been able to get the example files that should have been on
the cd (the cd just has a file that says it wasn't ready). So I'm
walking throught it manually. I'm getting the error "Excel cannot open
the file 'Excel 2007 Custom Ribbon Example.xlsm' because the file
format or file extension is not valid. Verify that the file has not
been corrupted and that the file extension matches the file format of
the file."

I've tried it with two new workbooks; same problem with both.

I do have "Show Add-In User Interface Errors" turned on.


Here's the VBA module text:

Sub CustomRibbonExample(control As IRibbonControl)
MsgBox "ok"
End Sub


Here's the customUI.xml:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/
customui">
<ribbon>
<tabs>
<tab idMso="TabData">
<group id="Group1" label="Custom">
<button id="Button1"
label="Custom Ribbon Example"
size="normal"
onAction="CustomRibbonExample"
imageMso="HappyFace" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>


Here's what I added to the .rels:

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


And here's the whole .rels:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationship Type="http://schemas.microsoft.com/office/2006/
relationships/ui/extensibility" Target="/customUI/customUI.xml"
Id="12335" />
<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="xl/workbook.xml"/></
Relationships>


Any idea what's wrong?

 
Reply With Quote
 
 
 
 
Jim Rech
Guest
Posts: n/a
 
      16th Sep 2007
The error message says that the file extension does not match the type of
file. The XLSM extension indicates a file in the new Excel 2007 format that
contains a VB project. So something isn't right with the file. Either it
doesn't have a VB project or the file is not in the new format or it is
corrupted or ... who knows.

To see an example of this name mismatch, save an empty new Excel file as a
workbook (XLSX supplied automatically by Excel). Close it, rename it to
XLSM via Windows Explorer, and then try to open it.

If you really think it meets all the requirements I'd be happy to look at it
if you want to email it to me.

--
Jim
"Greg Lovern" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I'm trying to do the custom ribbon example on pages 736 - 739 of John
> Walkenbach's "Excel 2007 Power Programming with VBA".
>
> I haven't been able to get the example files that should have been on
> the cd (the cd just has a file that says it wasn't ready). So I'm
> walking throught it manually. I'm getting the error "Excel cannot open
> the file 'Excel 2007 Custom Ribbon Example.xlsm' because the file
> format or file extension is not valid. Verify that the file has not
> been corrupted and that the file extension matches the file format of
> the file."
>
> I've tried it with two new workbooks; same problem with both.
>
> I do have "Show Add-In User Interface Errors" turned on.
>
>
> Here's the VBA module text:
>
> Sub CustomRibbonExample(control As IRibbonControl)
> MsgBox "ok"
> End Sub
>
>
> Here's the customUI.xml:
>
> <customUI xmlns="http://schemas.microsoft.com/office/2006/01/
> customui">
> <ribbon>
> <tabs>
> <tab idMso="TabData">
> <group id="Group1" label="Custom">
> <button id="Button1"
> label="Custom Ribbon Example"
> size="normal"
> onAction="CustomRibbonExample"
> imageMso="HappyFace" />
> </group>
> </tab>
> </tabs>
> </ribbon>
> </customUI>
>
>
> Here's what I added to the .rels:
>
> <Relationship Type="http://schemas.microsoft.com/office/2006/
> relationships/ui/extensibility" Target="/customUI/customUI.xml"
> Id="12335" />
>
>
> And here's the whole .rels:
>
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <Relationship Type="http://schemas.microsoft.com/office/2006/
> relationships/ui/extensibility" Target="/customUI/customUI.xml"
> Id="12335" />
> <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="xl/workbook.xml"/></
> Relationships>
>
>
> Any idea what's wrong?
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to change "Enabled" state of an Excel 2007 ribbon gallery b basso profondo Microsoft Excel Programming 4 23rd Mar 2010 01:01 PM
Can't find "Visual Basic" Toolbar on Excel 2007 Ribbon gimme_this_gimme_that@yahoo.com Microsoft Excel Programming 3 17th Feb 2010 01:06 AM
Excel 2007 ribbon Controls & "My.Settings" equivalent in VBA rogge Microsoft Excel Programming 0 8th Jan 2009 11:33 PM
How to use "Mailings" Tab buttons into custom Ribbon Tab. kjpune@gmail.com Microsoft Word New Users 0 3rd Aug 2007 03:40 PM
"Excel 2003 Power Programming With VBA" John Walkenbach - pls share al007 Microsoft Excel Programming 1 7th Jan 2006 05:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:37 AM.