Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
appi_priya
Contributor III
Contributor III

Export button notworking through Macros

Hi all,

In one of the report after hitting the export button out 2000 records from the straight table only 6 records doesn't gets exported on an excel sheet. But when I do a right click and send to excel I get all the 2000 records. Not sure why it's happening, can somebody please guide. I checked my data model files and all records are present in the data model. Below is the macros for the export button:

sub exportToExcel

dim o
ExportPath = ActiveDocument.Variables("vExportPath").GetContent.String
ObjectID = ActiveDocument.Variables("vObjectID").GetContent.String
ChartName = ActiveDocument.GetSheetObject(ObjectID).GetCaption.Name.v
Set o = ActiveDocument.GetSheetObject(ObjectID)
o.ExportBiff ExportPath & ChartName & ".xls"

Set o = nothing


end sub

6 Replies
marcus_sommer

Are you sure that's the same object by exporting and send to excel?

- Marcus

appi_priya
Contributor III
Contributor III
Author

Hi Marcus,

Yes its the same object that's sending to excel through button macros and also while doing send to excel.

marcus_sommer

Could you check this behaviour with more or less data (I mean add or change selections) and then build the object new and check again and if it then happens again please provide an example.

- Marcus

appi_priya
Contributor III
Contributor III
Author

so if I change my selection to other values the export button works fine while exporting to excel its only those 6 specific records that it's not exporting.

if I try exporting those 6 records into excel with the help of button I get a blank excel file with just the field names on it but no values.

nagireddy_qv
Creator II
Creator II

HI ,,

May be this guide will help to you....

marcus_sommer

The only reason I could imagine is that there are some "special" chars within those records which vbs-macros couldn't handle and ignore them without giving an error-message (silent failure). I know such behaviour from vba-macros which I use for writing txt-files from sources which I couldn't control - I use in this case a white-list filter for checking each char and if it's not included within the white-list it will be replaced with a space-char.

But this won't be really practically by exporting this object - it's rather the worst-case approach to write these object cell by cell and char by char to excel. More practically might be a cleaning within the qlikview-load or by declaring the dimensions by using functions like keepchar() or purgechar() on this field which caused this behaviour.

Therefore try to check out if there are any strange chars within your data - checking len() and visible word-lengths, using ord() to get numeric index and something similar. But the easiest way to check this could be to use this for the object-dimensions:

keepchar(upper(YourDimension), 'ABCD....')

- Marcus