Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have a list box with 14 entries.
For each selection, I want to:
copy a specific table from QlikView (ex. CH1000)
For example, if I have a list box (Product) with four entries: A, B, C, D I want a macro that
selects Product A, B and C and saves table CH1000 to a csv file
I do not need the code to be dynamic, so I could specify each combination of filters to apply (i.e., ABC, BCD, CDA). But as my VB skills are limited, I am not sure how to implement this.
I am open to any alternatives beyond VB and appreciate any help!
Hello Michael,
Here is a vbscript that will do exactly what you want except that outout Format is xls.
You can Change it to csv if you want.
Change LB01 to your Listbox Name.
Change CH02 to your Chart Name.
Change "Name" to the fieldname of your listbox
Change path.
sub export_to_csv()
ActiveDocument.ClearAll
set lb = ActiveDocument.GetSheetObject("LB01") 'Listbox Name
set ch = ActiveDocument.GetSheetObject("CH02") 'Chart Name
path = "C:\temp\" 'output Path
ActiveDocument.Fields("Name").SelectAll
set values = ActiveDocument.Fields("Name").GetSelectedValues
For i = 0 to ActiveDocument.Fields("Name").GetSelectedValues.Count - 1
ActiveDocument.Fields("Name").Select values.Item(i).Text
ActiveDocument.Fields("Name").SelectExcluded
name_Excel = "All_Except_" & values.Item(i).Text & ".xls"
ch.ExportBiff path & name_Excel 'Export to xls
next
end sub
regards
Tim
Hello Michael,
Here is a vbscript that will do exactly what you want except that outout Format is xls.
You can Change it to csv if you want.
Change LB01 to your Listbox Name.
Change CH02 to your Chart Name.
Change "Name" to the fieldname of your listbox
Change path.
sub export_to_csv()
ActiveDocument.ClearAll
set lb = ActiveDocument.GetSheetObject("LB01") 'Listbox Name
set ch = ActiveDocument.GetSheetObject("CH02") 'Chart Name
path = "C:\temp\" 'output Path
ActiveDocument.Fields("Name").SelectAll
set values = ActiveDocument.Fields("Name").GetSelectedValues
For i = 0 to ActiveDocument.Fields("Name").GetSelectedValues.Count - 1
ActiveDocument.Fields("Name").Select values.Item(i).Text
ActiveDocument.Fields("Name").SelectExcluded
name_Excel = "All_Except_" & values.Item(i).Text & ".xls"
ch.ExportBiff path & name_Excel 'Export to xls
next
end sub
regards
Tim
Hi Tim, this worked perfectly! The only change I made was saving the file as ".csv" instead of ".xls" I really appreciated all of your help.