errorfunktion

Hi,

I've used the custom UI editor to try to add an icon my a button on a new tab.
The new button is added but the icon is not displayed on it.
The contents of the customUI folder is:

_rels\customUI.xml.rels:

< xml version="1.0" encoding="utf-8" >
- <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="images/Green_Atom.png" Id="Green_Atom" />
</Relationships>


\images\GreenAtom.png

customUI.xml:

- <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
- <ribbon startFromScratch="false">
- <tabs>
- <tab id="customTab" label="Custom Tab">
- <group id="customGroup" label="Custom Group">
<button id="customButton" label="Custom Button" imageMso="Green_Atom" size="large" onAction="Callback" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>

This seems correct and no error message is raised, so why is it not displayed



Re: Visual Studio Tools for Office Custom icons will not display on the ribbon

Robert Green

You need to add a loadImage attribute to the customUI element, for example

<customUI

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

onLoad="OnLoad" loadImage="GetImage" >

GetImage will return the image you want loaded. Office will call this procedure for each Ribbon control that uses a custom image.

Public Function GetImage(ByVal imageName As String) As Bitmap

Select Case imageName

Case "Green_Atom"

Return New Bitmap(My.Resources.GreenAtom)

End Select

End Function

The code above assumes you added the png file as a resource to the project.

Robert