Dynamic ribbon syntax

  • Thread starter Thread starter 67nmark
  • Start date Start date
6

67nmark

Guest
Hello,

I'm in the process of trying to take some of my VBA and converting it into VB and I've ground to a halt almost as soon as I've started so I'd really appreciate any assistance with converting the ribbon customisations:

This works in VBA/XML and this is what I'm trying to change:

VBA:

I have a module called TemplatePicker with the following:

Sub GetScreenTip(Control As IRibbonControl, ByRef screentip)

Select Case Control.ID

Case "ShowTemplateMenu"
screentip = "Create a new document"

Case Else
'Do Nothing

End Select

End Sub

Sub GetScreenTip(Control As IRibbonControl, ByRef screentip)

Select Case Control.ID

Case "ShowTemplateMenu"
screentip = "Create a new document"

Case Else
'Do Nothing

End Select

End Sub


XML:

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<ribbon>
<tabs>
<tab idMso="TabHome">
<group id="grpTemplatePicker" label="Templates" insertBeforeMso="GroupClipboard" >

<dynamicMenu id="ShowTemplateMenu"
getContent="TemplatePicker.ShowTemplateMenu"
getImage="TemplatePicker.GetImage"
size="large"
label="Pick a template"
getScreentip="TemplatePicker.GetScreentip"
getSupertip="TemplatePicker.GetSupertip" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>

I've tried the same XML in visual studio and the button displays but the dynamic stuff doesn't work (ie. the 'label' displays but the 'screentip' doesn't. Here's what I've got in ThisAddin in VB:

Sub GetScreentip(ByRef control As Office.IRibbonControl, ByRef screentip As String)

Select Case control.Id

Case "ShowTemplateMenu"

screentip = "Create a new document"

Case Else
'Do Nothing

End Select

End Sub

I hope this makes sense. I can't find any documentation that walks you through this kind of ribbon customisation in VB. The C# stuff I've found is not helping me either (and I'm new to this so the differences between C# and VB are lost on me).

Thanks in advance,

Mark

Continue reading...
 
Back
Top