Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Assign QV variable value in Macro

Hi Friends,

I want to assign the QV variable value inside Macro and call the macro using button click.

Below is the coding I have used:

Sub Procedure

dim strValueToDisplay

set strValueToDisplay =  ActiveDocument.Variables("V_AMID_Macro").GetContent().String

msgbox("The value of ""vValueToDisplay"" is: " & strValueToDisplay)

END Sub

But when I click the button it is taking to the edit module page instead of displaying the message box.

Please help to solve the issue.

Thanks.

1 Solution

Accepted Solutions
marcus_sommer

Change it into:

Sub Procedure

dim strValueToDisplay

strValueToDisplay =  ActiveDocument.Variables("V_AMID_Macro").GetContent.String

msgbox("The value of ""vValueToDisplay"" is: " & strValueToDisplay)

END Sub

- Marcus

View solution in original post

3 Replies
marcus_sommer

Change it into:

Sub Procedure

dim strValueToDisplay

strValueToDisplay =  ActiveDocument.Variables("V_AMID_Macro").GetContent.String

msgbox("The value of ""vValueToDisplay"" is: " & strValueToDisplay)

END Sub

- Marcus

tamilarasu
Champion
Champion

Or try,

Sub Procedure

         Set var = ActiveDocument.Variables("V_AMID_Macro")

          MsgBox("The value of ""vValueToDisplay"" is: " & var.GetContent.String)

End Sub

jagan
Luminary Alumni
Luminary Alumni

Hi,

The message box expression should be

msgbox("The value of vValueToDisplay is: " & strValueToDisplay)


Is vValueToDisplay  is a variable in macro?  If yes also create a variable for this.

Check this link for more macro samples

Useful Qlikview Macros