Hi
Just wondering if it is possible to pass a value or know which toolbar button was clicked of say 6. All doing exactly same except one minor change. Basically, calling the same sub to do multiple things.
Thanks.
Robie.
pass toolbar button clicked to sub/function
-
- 5StarLounger
- Posts: 656
- Joined: 18 Feb 2010, 14:26
-
- 2StarLounger
- Posts: 102
- Joined: 04 Feb 2010, 22:44
- Location: Melbourne Australia
Re: pass toolbar button clicked to sub/function
What version of Word are you using?
I don't know how to do this in Word 2003 and looking at this VBA example it doesn't look like that author knows either (but he can create code that almost does it) -http://www.codeforexcelandoutlook.com/b ... look-2003/
In Word 2007 and 2010 it is very easy, you can either use the tag or id attributes of the control. eg
Sub ApplyStyle(control As IRibbonControl)
Selection.Style = control.ID
End Sub
I don't know how to do this in Word 2003 and looking at this VBA example it doesn't look like that author knows either (but he can create code that almost does it) -http://www.codeforexcelandoutlook.com/b ... look-2003/
In Word 2007 and 2010 it is very easy, you can either use the tag or id attributes of the control. eg
Sub ApplyStyle(control As IRibbonControl)
Selection.Style = control.ID
End Sub
Andrew Lockton
Melbourne Australia
Melbourne Australia
-
- 5StarLounger
- Posts: 656
- Joined: 18 Feb 2010, 14:26
Re: pass toolbar button clicked to sub/function
Thank you. I will look into it.Guessed wrote:What version of Word are you using?
I don't know how to do this in Word 2003 and looking at this VBA example it doesn't look like that author knows either (but he can create code that almost does it) -http://www.codeforexcelandoutlook.com/b ... look-2003/
In Word 2007 and 2010 it is very easy, you can either use the tag or id attributes of the control. eg
Sub ApplyStyle(control As IRibbonControl)
Selection.Style = control.ID
End Sub