Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I wan to call a Parameterized Macro from button action
how can I do that?
Ususally I define a variable in the document then I read that variable inside the macro and set the value of the variable in the button ...
Hopeit helps
Hi
Actually, I have created one Macro sub procedure with parameters in Macro
The parameters are ChartID and txt odject Id.
so, on button click I want to pass that particular Chart ID and txt odject Id through parameters.
lets see 2 e.g.
1) e.g.
suppose I hv 1 sub
sub xy(p1, p2)
......
.......
End sub
on button action , I wrote xy("a","b").
after, if click on button, it didnt perform any action.
but
2) e.g.
In macro If I call sub xy("a","b") like
Sub Scall
xy("a","b")
End Sub
and if i wrote Scall Macro on button Action
then It works.., Perfect....
but I need to follow 1st scenario.
You can add actions to a button. First add an action that sets the value of a variable. Next add an action that executes a macro. The macro will have to use the variable. You cannot directly pass a value to a macro, so that's why you need to use a variable.
Sub MYSUB
set v = ActiveDocument.GetVariable("MyVar")
select case v.GetContent.String
case 1
v.SetContent "0",true
... do something else
case else
v.SetContent "1",true
... do something else
end select
end sub
This script read a variable MyVar defined in the document and you can set ithe variable with the button; there is no way to pass parameters in other way