C
Christopher King
Greetings,
I am moving a VBA add-in to Excel 2007. Although a button for the add-in
can be installed with a built-in icon, I have not been able to get a custom
icon into the package. A VBA add-in needs to be one file so that it is easy
to install. VBA doesn't have a "resource area" in which to store files, yet,
somehow the custom icon needs to be contained within the add-in. I'm
wondering if anyone knows how to do this. Here's what I've done so far.
My add-in test file, "Testing.xlsm", now has the following structure:
_rels (folder)
.rels
customUI (folder)
customUI.xml
_rels (folder)
customUI.xml.rel
docProps (folder)
Images (folder)
O22minus.ico
xl (folder)
[Content_Types].xml
To create this structure, the following were done: The icon file,
"O22minus.ico", was placed in a folder, "Images". This folder was added to
the add-in test file, "Testing.xlsm". (Add .zip to the file name, open, add
the folder, close, remove .zip.)
The "customUI.xml" file has the following following added to the "Button"
section:
image="icon1"
"icon1" is a relationship ID.
To establich a relationship between the two files, a relatonship was
created. A relationship folder, "_rels" was created in the same folder that
contains "customUI.xml". The relationship file placed in "_rels" is called
"customUI.xml.rel". It contains the following five lines:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships
xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="icon1"
Type="http://schemas.microsoft.com/office/2006/relationships/image"
Target="/Images/O22minus.ico"/>
</Relationships>
As you can see, it provides the relation between "icon1" and "O22minus.ico".
When I run this file I get an error message: "Excel found unreadable
content in Testing.xlsm..." On telling Excel to load the file anyway,
another error message says "An error occurred while loading image with
relatonship ID icon1."
My guess is that something needs to be added to the "[Content Types].xml"
file, telling it what a ".ico" file is.
I know Microsoft is hard at work getting Office 2007 ready for release.
I and probably other VBA add-in programers look forward to documentation
showing how to solve the described problem.
Chris
I am moving a VBA add-in to Excel 2007. Although a button for the add-in
can be installed with a built-in icon, I have not been able to get a custom
icon into the package. A VBA add-in needs to be one file so that it is easy
to install. VBA doesn't have a "resource area" in which to store files, yet,
somehow the custom icon needs to be contained within the add-in. I'm
wondering if anyone knows how to do this. Here's what I've done so far.
My add-in test file, "Testing.xlsm", now has the following structure:
_rels (folder)
.rels
customUI (folder)
customUI.xml
_rels (folder)
customUI.xml.rel
docProps (folder)
Images (folder)
O22minus.ico
xl (folder)
[Content_Types].xml
To create this structure, the following were done: The icon file,
"O22minus.ico", was placed in a folder, "Images". This folder was added to
the add-in test file, "Testing.xlsm". (Add .zip to the file name, open, add
the folder, close, remove .zip.)
The "customUI.xml" file has the following following added to the "Button"
section:
image="icon1"
"icon1" is a relationship ID.
To establich a relationship between the two files, a relatonship was
created. A relationship folder, "_rels" was created in the same folder that
contains "customUI.xml". The relationship file placed in "_rels" is called
"customUI.xml.rel". It contains the following five lines:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships
xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="icon1"
Type="http://schemas.microsoft.com/office/2006/relationships/image"
Target="/Images/O22minus.ico"/>
</Relationships>
As you can see, it provides the relation between "icon1" and "O22minus.ico".
When I run this file I get an error message: "Excel found unreadable
content in Testing.xlsm..." On telling Excel to load the file anyway,
another error message says "An error occurred while loading image with
relatonship ID icon1."
My guess is that something needs to be added to the "[Content Types].xml"
file, telling it what a ".ico" file is.
I know Microsoft is hard at work getting Office 2007 ready for release.
I and probably other VBA add-in programers look forward to documentation
showing how to solve the described problem.
Chris