![]() |
|
#7
|
|||
|
|||
|
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>
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
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
See: http://gregmaxey.com/word_tip_pages/...bbon_main.html |
| Tags |
| macro, microsoft word 2010, ribbon |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
How to Pass Arguments in a Formula?
|
tinfanide | Excel Programming | 2 | 10-13-2014 06:10 AM |
How to Pass Document to this Sub
|
ilcaa72 | Word VBA | 1 | 01-28-2014 03:04 PM |
| How to import the customized ribbon to Word without overwriting the existing Ribbon? | SharonSh | Word VBA | 0 | 09-26-2013 11:47 PM |
| How to pass parameters to a .msg file? | HereNow | Outlook | 0 | 11-05-2012 10:38 AM |
| Excel 2010 Ribbon look like 2007's Ribbon | esotop | Excel | 0 | 03-22-2011 07:05 PM |