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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Keeping leading zero when exporting to Excel using Macro

Hello QlikView Community,

I have a macro that creates an Excel file with  multiple tabs and with it different data sets in each tab.  For each tab, there is a column (column L titled AuthId) that has an 9-digit ID number (includes leading zero).  In my data, this leading zero is definitely recognized by QlikView (I see the leading zero when I view that field--see picture below).  However, this leading zero is dropped when the macro exports the data to the Excel file.

What can I add to my macro script to keep or even add a leading zero to this field?

What it should look like:

This is my macro script for this file:

sub exportToExcel_Variant6

'// Array for export definitions
Dim aryExport(2,3)

aryExport(0,0) = "objPended"
aryExport(0,1) = "Pending"
aryExport(0,2) = "A1"
aryExport(0,3) = "data"

aryExport(1,0) = "objApproved"
aryExport(1,1) = "Approved"
aryExport(1,2) = "A1"
aryExport(1,3) = "data"

Dim objExcelWorkbook 'as Excel.Workbook
Set objExcelWorkbook = copyObjectsToExcelSheet(ActiveDocument, aryExport)

end sub

Thank you in advance for any help.  Please let me know what other information I can provide to help resolve this.

0 Replies