Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Export to Excel from qlikview looping over different customers

Dear qlik community,

I have a simple thing (?) that I would like to get support with. I want to export a chart to excel for each customer number that I have in my report. So each customer gets an own excel file. For this reason I have created the below macro (VBScript) - but it only gives me 100 excel files and I have more than 1500 customers.

Could anyone please let me know what I'm doing wrong?

Sub CreateExcelfile

  nCount=1

  strLibrary="C:\Users\yyyy\Documents\PartsOpportunityFiles\"

  ActiveDocument.Variables("vDate").SetContent strDate, true

  ActiveDocument.Fields("Final Customer Name and Number").Clear

  Set strSupplierList = ActiveDocument.Fields("Final Customer Name and Number").GetPossibleValues

  For nCurrentSupplier = 0 To strSupplierList.Count-1

  strCurrentSupplierName = strSupplierList.Item(nCurrentSupplier).Text

  ActiveDocument.Fields("Final Customer Name and Number").Select strCurrentSupplierName

  set obj = ActiveDocument.GetSheetObject("CH20")

  obj.ExportEx strLibrary & "\" & strCurrentSupplierName & " " & strDate & ".xls",5

  nCount=nCount+1

  Next

  MsgBox "Created " & nCount-1 & " files"

End Sub

1 Solution

Accepted Solutions
Gysbert_Wassenaar

The GetPossibleValues is limited by default to 100 values. You can add a parameter to retrieve more values. Try

Set strSupplierList = ActiveDocument.Fields("Final Customer Name and Number").GetPossibleValues(2000)


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

The GetPossibleValues is limited by default to 100 values. You can add a parameter to retrieve more values. Try

Set strSupplierList = ActiveDocument.Fields("Final Customer Name and Number").GetPossibleValues(2000)


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks! that did the trick for me!

Regards,

Martin