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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
ngulliver
Partner - Specialist III
Partner - Specialist III

How do you apply selection criteria in a Macro ?

Hi,

I am currently exporting a whole table CH02 using a macro.I need to set the selection criteria in a macro so that I can export only one particular name from the CH02 table. The code I have currently is:

sub ExtractData

   Const ForReading = 1

   Const ForWriting = 2


   vExFolder = ActiveDocument.Variables("vFolderName").GetContent.String


   vFullFileName = vExFolder & "Census Data" & ".xls"


   set sObject = ActiveDocument.GetSheetObject("CH02")


   sObject.Export vFullFileName, ""


end sub

The selection criteria has to be done within the macro rather than using the Set Variable Action asI would also like to clear that field afterwards so that I could export the details of another name to a different destination within the same macro.

Many thanks,

Neil

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

ActiveDocument.Fields("Month").Select("Sep") will select value 'Sep' in field Month.

ActiveDocument.Fields("Month").Clear will clear the selection in field Month.


talk is cheap, supply exceeds demand

View solution in original post

1 Reply
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

ActiveDocument.Fields("Month").Select("Sep") will select value 'Sep' in field Month.

ActiveDocument.Fields("Month").Clear will clear the selection in field Month.


talk is cheap, supply exceeds demand