Skip to main content
Announcements
YOUR OPINION MATTERS! Please take the Qlik Experience survey you received via email. Survey ends June 14.
cancel
Showing results for 
Search instead for 
Did you mean: 
smilingjohn
Specialist
Specialist

Variable

HI All,

I have two list boxes one is for Month and the other is for Year .

And i have straight table which iam importing to export by Macro.

I wanted to know how can we save the file path by selected year and month.

i need to create a variable for month and year then i want to bring this variable in the path of macro .

Can some one help me

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try something like:

filepath="D:\EXCEL TO EXPORT\"
Set yearVar=ActiveDocument.GetVariable("vYear")
Set monthVar=ActiveDocument.GetVariable("vMonth")
Set filename=yearVar&monthVar
....
XLDoc.SaveAs filePath & filename

View solution in original post

5 Replies
tresesco
MVP
MVP

You can define variables like:

vYear=YearField

vMonth=MonthField

And then use them in your macro. If you need help there too, try to share your macro code here.

smilingjohn
Specialist
Specialist
Author

Thanks Trescco ,

i have already created the variable , i have already defined a path  iam sending u the file ,

actaully when the file is being saved it has to give me which year and whivh month .

i hope u undertood .

Plz find the attachment

jyothish8807
Master II
Master II

Hi Roy,

Try to create a variable in macro itself instead of creating in qlikview and call this variable in your macro.

sub ( .... )

dim var1=XXXX

path: c://New Folder/var1

Hope it help.

Regards

KC

Best Regards,
KC
tresesco
MVP
MVP

Try something like:

filepath="D:\EXCEL TO EXPORT\"
Set yearVar=ActiveDocument.GetVariable("vYear")
Set monthVar=ActiveDocument.GetVariable("vMonth")
Set filename=yearVar&monthVar
....
XLDoc.SaveAs filePath & filename

smilingjohn
Specialist
Specialist
Author

HI Jyothish

Iam not understanding how to do it

I have already attached the macro code . Which will export different excel files by country by branch and by city

where do i define the variable ?