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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
chrisbrain
Partner - Specialist II
Partner - Specialist II

Selecting ListBox/Table Cells Via Macro

I understand that fields can be selected via macros using something like:

ActiveDocument.Fields("Year").Select '.....'

But what if I need to select an item or a number of items in a listbox which is based on an expression rather than a field? Or alternatively select a cell or range of cells in a table object?

I am experimenting with code similar to the following:

Set oLB_Cat = ActiveDocument.GetSheetObject("CAT")
Set oCell = oLB_Cat.GetCell(1,0)
oCell.State = 1

But it does not seem to have any effect. Is this the right approach or is there another method?

beeido.com - BI | Software | Qlik Integration Services
GitFirst - A CI/CD solution for Qlik Sense
1 Reply
Not applicable

Following should work in your macro. It will look for range of valeus between two values and select it for the field


'''set variable with values
set vVarStart=ActiveDocument.Variables("vStart")
set vVarEnd=ActiveDocument.Variables("vEnd")
''get you expression in the variable.
vStartSearch= vVarStar.GetContent.String
vEndSearch=vVarEnd.GetContent.String

'''Search values of your variable

vSearch = "=IF( [YourField] >= '" & vStartSearch & "' AND [YourField] <= '" & vEndSearch & "',True(),False())"
ActiveDocument.Fields("YourField").Select vSearch