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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
vlad_komarov
Partner - Specialist III
Partner - Specialist III

Exporting to multiple Tabs of the same Excel file

Hi,

I am exporting some of my tables to Excel using the following:

set objExport = ActiveDocument.GetSheetObject("CH24")

objExport.ExportEx fileName1,5

set objExport = ActiveDocument.GetSheetObject("CH59")

objExport.ExportEx fileName2,5

Is it possible to create multiple tabs in the same Excel file and export each chart to separate tabs, and not separate files like above?

Looking forward to suggestions.

Best regards,

Vladimir

13 Replies
shanmurugesh
Partner - Contributor II
Partner - Contributor II

Hi rebeccad


It is working great, but i'm facing one small issue, i unable to load more than 3 sheets in single excel.


could you please help?

Note:

there are two set of file

first one is with 2 sheet - it is working fine

Second one is with 4 sheet -it is not working properly.

and also check "Current local security"  before run the macro..

Thanks and regards,

Murugesan.N

askarkhan
Contributor III
Contributor III

hi,

This is very useful macro which you have shared. any how i am getting an error please help me out with this.

please see attchment for error. i am geting error in line

XLDoc.Sheets(2).Paste() 

please have a look and get a solution for me.

Thank you!

 

error.JPG

iCushy
Contributor
Contributor

Hi

I had this same issue and it was related the the default number of Sheets that are created in Excel when you create a new Workbook. mine was set to 1 but most users have it set to 3, which is why there is a line

XLDoc.Sheets(3).Delete

if you open Excel and go to options, and change the default number of sheets from 1 to 2, this script will work for you but you will also need to REM the following line

REM XLDoc.Sheets(3).Delete

Unless you increase the default sheets to 3, then you can leave it as is.

iCushy
Contributor
Contributor

Hi

Increase your excel default sheets per new workbook to 4 and your code should work.

Excel>Options>General - Include this many sheets from 3 to 4.

Regards