Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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.
New Contributor III

Exporting to Excel and Selection Issues

I'm trying to automate export a table to multiple excel worksheets. In each sheet is a different selection collection.

The issue I have encountered is that intially I want to select all customers that start with "ABC" (which is straightforward) but then select all customers not starting with "ABC" and export these to the next excel worksheet.

I tried this line in the macro but it does not appear to behave in the same way as manually using select excluded in the application -


Is there any way to write a line in the macro that would select all "CustomerName"s not beginning with "ABC"?

sub ReportExport

set XLApp = CreateObject("Excel.Application")

XLApp.Visible = false
set XLDoc = XLApp.Workbooks.Add

'Bring total of sheets upto 4

XLDoc.Sheets(1).Name = "Report1"
ActiveDocument.GetSheetObject("CH162").CopyTableToClipboard true


XLApp.Visible = true

Set C=ActiveDocument.Getfield("ChannelName")
C.Select "Channel1"

ActiveDocument.GetField("CustomerName").SelectExcluded ' Does not appear to work as it would in the application

'Export Report to next sheet etc

msgbox "Done"

end sub
Tags (3)
Community Browser