Custom UI DynamicMenu

Douglas Prince 1 Reputation point
2022-01-31T17:17:39.54+00:00

Hello,

I have written a function to the necessary STRING to generate id, buttons and labels for a dynamicMenu.

However, what is the same for each button is the onAction="RunSub". But how to i pass something unique into the RunSub call back function?

The CustomUI support says to use a tag:

         <button   id="button" label="Button" tag="123456" onAction="RunSub" />

How do i pass the string "123456" into RunSub. Right now i have this:

        Sub RunSub(control As IRibbonControl, tag As String)

                MsgBox tag

        End Sub

I am expecting an MsgBox to appear with 123456 on it. Instead this produces an Argument not Optional error.

How can i fix this?

Regards,
Douglas

0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Viorel 117.2K Reputation points
    2022-01-31T17:33:02.997+00:00

    Do you receive the same error if you remove the MsgBox line?

    Try this too:

    Sub RunSub( control As IRibbonControl )
       MsgBox control.Tag
    End Sub
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.