Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Export data using macro

I am exporting the data in a straight chart to .xls in a specified path. works fine BUT I want to name the .xls file with today's date. Is there a way I can pass date stamp for the file name?

sub export

set obj = ActiveDocument.GetSheetObject("CH191")
obj.ExportBiff "\\shared-us\Archive\shared\DAILY_EXPORT\Today().xls"

END SUB

1 Solution

Accepted Solutions
danielrozental
Master II
Master II

There is plenty of vbscript resources in the web, I would recommend this one as a reference http://w3schools.com/vbscript/vbscript_ref_functions.asp

sub export

set obj = ActiveDocument.GetSheetObject("CH191")

obj.ExportBiff "\\shared-us\Archive\shared\DAILY_EXPORT\" & right("0" & month(date()),2) & "-" & right("0"&day(date()),2) & "-" & year(date()) & "-daily.xls"

END SUB

View solution in original post

4 Replies
danielrozental
Master II
Master II

Sure, try something like

sub export

set obj = ActiveDocument.GetSheetObject("CH191")

obj.ExportBiff "\\shared-us\Archive\shared\DAILY_EXPORT\" & year(date())*10000+month(date())*100 + day(date()) & ".xls"

END SUB

Not applicable
Author

Thanks Dan

But I want my file named as mm-dd-yyyy-daily.xls .

danielrozental
Master II
Master II

There is plenty of vbscript resources in the web, I would recommend this one as a reference http://w3schools.com/vbscript/vbscript_ref_functions.asp

sub export

set obj = ActiveDocument.GetSheetObject("CH191")

obj.ExportBiff "\\shared-us\Archive\shared\DAILY_EXPORT\" & right("0" & month(date()),2) & "-" & right("0"&day(date()),2) & "-" & year(date()) & "-daily.xls"

END SUB

Not applicable
Author

Thanks for the refernce and solution .. That really helps