You don't call ButtonOnAction. It is the VBA callback for your RibbonX control. Here is a basic example:
This is RibbonX to build a basic tab with two buttons:
Code:
customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<ribbon>
<tabs>
<tab id="custTab1"insertBeforeMso="TabHome"label="Demo Tab">
<group id="Grp0"label="Demo Group">
<button id="Grp0Btn1"tag="1"label="Demo Button 1"
imageMso="SlideThemesGallery"size="large"
onAction="modRibbonControl.ButtonOnAction" />
<button id="Grp0Btn2"tag="1"label="Demo Button 1"
imageMso="SlideThemesGallery"size="large"
onAction="modRibbonControl.ButtonOnAction" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
This is the code in a VB module named modRibbonControl:
Code:
Sub ButtonOnAction(control As IRibbonControl)
Dim arrParts() As String
Select Case control.ID
Case "Grp0Btn1", "Grp0Btn2"
'Here are two ways using the defined ID or the defined tag:
'1
arrParts = Split(control.ID, "Btn")
modMain.SomeSubThatTakesArgurments arrParts(1)
'2
modMain.SomeSubThatTakesArgurments control.Tag
End Select
lbl_Exit:
Exit Sub
End Sub
Here is the code for a standard module named modMain
Code:
Sub SomeSubThatTakesArgurments(ByRef strArg As String)
Select Case strArg
Case "1": MsgBox "Do this"
Case "2": MsgBox "Do that"
End Select
lbl_Exit:
Exit Sub
End Sub
If you are trying to do this with the cheesy ribbon editor built-in to Word then I can only say, abandon hope all who go there.
See:
http://gregmaxey.com/word_tip_pages/...bbon_main.html