Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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.

Community Browser