Skip to main content
Announcements
Qlik Community Office Hours - Bring your Ideation questions- May 15th, 11 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Execute VB Function with parameter from a Button

Hi all,
i would like to run a VB function with parameters by click on a button.
The function is not running, can  someone help me?

The Action in my Button is: =SetVars('myVarName')
My VB Function is:

Function SetVars(s)
Set v = ActiveDocument.Variables(s & "_v")
  If v.GetContent.String = "1" Then
   v.SetContent "0", true
  Else
   v.SetContent "1", true
  End If
End Function

2 Replies
nagaiank
Specialist III
Specialist III

If the requirement is to toggle the variable value between 1 and 0, you may implement using a button with action. There is no need for a VB macro. An example is attached.

Not applicable
Author

Thats perfect!
Thanks!!!