Hi Albert,
this is the complete code I use for this:
<customUI xmlns="
http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="true">
<tabs>
<tab id="tabPrintPreview" label="Preview and Print">
<group id="grpPrint" label="Print" visible="true">
<button idMso="PrintDialogAccess" size="large"
label="Print" imageMso="PrintDialogAccess"/>
<button idMso="PublishToPdfOrEdoc" size="large"
label="Save As PDF"
getImage="GetImages" tag="AcroReader.ico"
supertip="Save this document as .pdf"/>
</group>
<group id="grpZoom" label="Zoom" visible="true">
<splitButton idMso="PrintPreviewZoomMenu" size="large"/>
<toggleButton idMso="ZoomFitToWindow" size="large"/>
<toggleButton idMso="PrintPreviewZoomTwoPages"
size="large"/>
</group>
<group id="grpClosePreview" label="Close Preview"
visible="true">
<button idMso="PrintPreviewClose" size="large"
label="Close Preview" imageMso="PrintPreviewClose"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
The icon image is being saved in a table in a binary format so it is always
with the db:
Public Sub GetImages(control As IRibbonControl, ByRef image)
'Callbackname in XML File "getImages"
Set image = getIconFromTable(control.Tag)
End Sub
Public Function getIconFromTable(strFilename As String) As Picture
Dim LSize As Long
Dim arrBin() As Byte
Dim rs As DAO.Recordset
Dim strSelectFile As String
On Error GoTo Errr
Set rs = DBEngine(0)(0).OpenRecordset("tblBinary", dbOpenDynaset)
rs.FindFirst "[FileName]='" & strFilename & "'"
If rs.NoMatch Then
Err.Raise vbObjectError + 5, "mdlBinary", _
"This file " & strFilename & " does not exist in
the table 'tblBinary!'"
Else
LSize = rs.Fields("binary").FieldSize - 1
ReDim arrBin(LSize)
arrBin = rs.Fields("binary")
Set getIconFromTable = ArrayToPicture(arrBin)
End If
rs.Close
fExit:
Reset
Erase arrBin
Set rs = Nothing
Exit Function
Errr:
MsgBox Err.Description
Resume fExit
End Function
This ribbon will be loaded everytime any report is being opened therefore,
if I understand you, using a global image loader will load the image once for
all the duration of the opened ribbon ? I think I understand if it is being
use for 1 image for a ribbon, but what about if I have 3 custom image per 1
specific ribbon, does the global image loader still do the same job ?, Please
keep in mind this is the first time I play with this ribbon stuff and quite
frankly, the reading I got from MS is not always quite clear.
Thanks