Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rustyfishbones
Master II
Master II

Can you call a Qlikview Variable in a Macro?

Hi All,

I have a Variable called vCustomer

I have a macro that creates a new Qlikview file that I got from the community

SUB createfile

Set Qv = CreateObject("QlikTech.QlikView")

Set docObj = Qv.CreateDoc

docObj.SaveAs "C:\Users\alan\Desktop\$(vCustomer).qvw"

docObj.CloseDoc

Set docObj = Qv.OpenDocEx (qvwFullPath,0,false)

docObj.Save

docObj.CloseDoc

Qv.Quit

END SUB

I tried adding the Variable vCustomer to save the new Qlikview file as the Customer in my project, but it does not work.

Any suggestions

Regards

Alan

4 Replies
jsingh71
Partner - Specialist
Partner - Specialist

HI Refer this, Hope this will help you

Macro.png

Not applicable

I use ActiveDocument.Variables("varname").getcontent.string to get value from the qvw..maybe you can parse that into the saveas command ?

alexandros17
Partner - Champion III
Partner - Champion III

set v = ActiveDocument.GetVariable("vWos_Amount")

where vWos_Amount is my variable

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Just as a side note to the already perfect replies from the others: macros do not have dollarsign-expansion applied to them. $(vVar) only works in QV script and in expressions, code for which the QlikView engine is responsible.

AFAIK macro's are handled by the standard Microsoft VBScript interpreter, that has no idea what $-sign substitution is actually. You'll have to pass through the QV object model to pick up variable values. Various methods to do this are provided in previous replies.

Good luck,

Peter