You are here: Gallery - onAction
Gallery - onAction
Executed when clicking an item in the Gallery.
Sample Ribbon XML file:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="CallbackOnLoad"> <ribbon startFromScratch="false"> <tabs> <tab id="MyTab" label="Gallery Sample"> <group id="MyGroup" label="Gallery Sample"> <labelControl id="myLabel1" label="Sample:" /> <labelControl id="myLabel2" label="Gallery" /> <gallery id="MyPictureGallery1" label="My Gallery" columns="2" rows="2" size="large" getItemImage="CallbackGetItemImage" getItemCount="CallbackGetItemCount" getItemLabel="CallbackGetItemLabel" getItemScreentip="CallbackGetItemScreentip" getItemSupertip="CallbackGetItemSupertip" getItemID="CallbackGetItemID" imageMso="PictureEffectsGlowGallery" getItemWidth="CallbackGetItemWidth" getItemHeight="CallbackGetItemHeight" getSelectedItemID="CallbackGetSelectedItemID" onAction="CallbackGalleryOnAction"> </gallery> </group> </tab> </tabs> </ribbon> </customUI>
Function to be copied to a standard module:
Sub CallbackGalleryOnAction(control As IRibbonControl, _ selectedId As String, _ selectedIndex As Integer) ' Callback onAction Select Case control.ID Case "MyPictureGallery1" MsgBox "You have " & DLookup("txtName", _ "tblPictures", "txtPicName = '" & _ Format(selectedIndex, "00") & "'") & _ " selected", vbInformation, _ "Gallery Sample" End Select End Sub
You can find this sample in Sample DB 2