Using a word template which has a custom Menu File item, menu items are
dynamically inserted via automation.
HOWEVER the onAction needs to pass a param to it's handler.....can this be
done?
Basically, is there a way that Word can associate N number of onActions
calls to the same actionHandler but with an index parameter?
For instance.
add (button1, onAction='handleSelection(1)')
add (button2, onAction='handleSelection(2)')
. . .
add (buttonN, onAction='handleSelection(N)')
. . .
sub handleSelection(n as integer)
switch(n)
. . .
Thanks in advance.
Jezebel - 14 Dec 2004 20:34 GMT
You can use the control's Tag and Parameter properties to attach additional
information to the control. When a control is clicked, the
CommandBars.ActionControl property gives you a reference to the control that
was used.
Set pButton = .Controls.Add(Type:=msoControlButton)
With pButton
.Caption = "Action " & pIndex
.Enabled = false
.OnAction = "HandleSelection"
.Style = msoButtonCaption
.Tag = 1
.TooltipText = "Action #" & pIndex
.Visible = true
End With
Public Sub HandleSelection
Select Case CommandBars.ActionControl.Tag
Case 1
.....
etc
> Using a word template which has a custom Menu File item, menu items are
> dynamically inserted via automation.
[quoted text clipped - 17 lines]
>
> Thanks in advance.