Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
markgraham123
Specialist
Specialist

Macro to export multiple tables in to single excel

Hi all,

I'm trying to fetch all tables/straight tables into single excel sheet using a macro( i can put this in a button).

Can some one please help here.

I'm new to QlikView and struggling on this.

Any help is really appreciated!!

16 Replies
markgraham123
Specialist
Specialist
Author

Nagaraj,

Here is the problem.

The excel is exporting, but since there is already a file name with that name, it's popping up the error and asking to replace the existing file.

Please see the attached.

I think, getting timestamp in the 'save as' class works.

I tried to but its not working.

tamilarasu
Champion
Champion

Hello Mark,

         Sorry for the late reply. I'm not active on weekends in this forum. You can replace the below line in macro.


oXL.ActiveWorkBook.SaveAs strSaveFile & replace(date, "/", "-") & ".xlsx"


oXL.ActiveWorkBook.SaveAs strSaveFile & ActiveDocument.Evaluate("date(Now(), 'DD-MM-YYYY hh:mm:ss')") & ".xlsx"

      Also, you no need to hard code the folder path in macro. Instead, create an inputbox and click new variable and name the variable as "vPath". Now, you can enter the path in front end. You need to change the below line in macro window.

Path = "C:\temp\"


Set Path = ActiveDocument.GetVariable("vPath")

Path = vPath.GetContent.String


Hope this helps you.

gagan_bhasin1
Contributor II
Contributor II

This is a gem in terms of macro for QlikView exports. I am trying to send a Pivot Table and List Box by this method. The data is going but the functionality is not traveling. May you please help in this regard?

tamilarasu
Champion
Champion

Hi Gagan,

Thank you. Could you please create a new thread and post some sample file and explain the issues that you are facing.  I have some important work to complete now. I'll finish it and answer your question within 2 hours. Hope this is fine with you. Don't forget to tag me.

gagan_bhasin1
Contributor II
Contributor II

Sure!

its_anandrjs

Hi arsu,

While using the above code explain by you it is still asking for save the file.

But actually, excel file to save on the mention location without asking for the file to save.

Can you check this, i have the same requirement.

Regards,

Anand

Luci19
Contributor
Contributor

Hi, 

I recently come across this thread and used the code in the sample qlikview module and it works except that it only exports one table despite the fact that i've changed the name of the other two tables to the ones i have in my module, any reason why? I've also amended the settings as originally suggested in the trail of emails but it seems that the macro gets stuck after exporting the first table

 

Thanks in advance,

Luci