Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

pls check the macro code

Hi to all,

how to create a new variable in another QVW file by using macro.

I tried like this but it showing error. What i should modify in below code.

Sub NewVar

set UserFile = App.OpenDoc ("Mydoc123.qvw","","")

set v2 =UserFile.CreateVar("vGet")

              ActiveDocument.ClearAll false  

End Sub

Pls any one can share your experience on this.

Regards

Venkat

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   Use below code.

Sub NewVar 

set App = ActiveDocument.GetApplication
set UserFile = App.OpenDoc ("Mydoc123.qvw","","")

UserFile.CreateVariable "vGet"

End Sub  

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

1 Reply
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   Use below code.

Sub NewVar 

set App = ActiveDocument.GetApplication
set UserFile = App.OpenDoc ("Mydoc123.qvw","","")

UserFile.CreateVariable "vGet"

End Sub  

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!