You are here: dynamicMenu - getContent
dynamicMenu - getContent
Sets the XML String of a Ribbon Control that describes the menu.
Sample Ribbon XML file:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="false">
<tabs>
<tab id="MyTab" label="Demo">
<group id="MyGroup" label="Demo">
<labelControl id="myLabel1" label="Sample:" />
<labelControl id="myLabel2" label="Menu" />
<menu id="MyMenu" label="Sample Menu"
itemSize="normal">
<dynamicMenu id="MyDynamicMenu"
label="Dynamic Menu"
getContent="CallbackGetContent"/>
</menu>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
Function to be copied to a standard module:
Sub CallbackGetContent(control As IRibbonControl, _
ByRef XMLString)
' Callback getContent
Dim lngDummy As Long
Dim strDummy As String
Dim strContent As String
strDummy = "<menu xmlns=""http://schemas.microsoft"
strDummy = strDummy & ".com/office/2006/01/customui"">"
For lngDummy = 0 To 5
strContent = strContent & _
"<button id=""MyDynaButton" & lngDummy & _
""" label =""Dynamic Item" & _
lngDummy & """/>"
Next
strDummy = strDummy & strContent & " </menu>"
XMLString = strDummy
End Sub
You can find this sample in Sample DB 2

