Hi, I'm new at DaniWeb. I hope I'm using the right protocol for this forum, but I was wondering:
Does anyone know how to tell in VBA which button of a Microsoft Word custom toolbar has been activated? Is there something like an ActionSource property that provides the toolbar control's caption or index or some other identifier so I can know in VBA which button was clicked? I'm trying to set up one subroutine that will use a Select Case structure to ascertain which button was clicked and then act accordingly.
I'm thinking that maybe the parameter property of the button could be used for this, but don't know how that would be done. If I use a subroutine like ExecuteButton (lngPosition) for the value of the button's OnAction property, then I get the "macro cannot be found" message. How can I pass the button's parameter to the subroutine without triggering that error?
Here's the code I'm attempting to develop:
Public Sub ExecuteButton(lngPosition As Long)
'I'm trying to supply the lngPosition argument at part of the button's OnAction property.
'It's a pointer to the button's position in relation to the other buttons.
'I use an Enum statement to specify button locations.
'So what I'm trying to assign to the button's OnAction property
'is like the following: "Execute Button(" & SPButtonPosition.eExclamation & ")"
'BUT THIS DOESN'T WORK
Select Case lngPosition
Case SPButtonPosition.eExclamation
Case SPButtonPosition.eLowerA
Case SPButtonPosition.eUpperUmlautU
oSpanishToolbar.UpperUmlautU
'Etc.
End Select
End Sub
Thanks