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: 
LaIs
Contributor
Contributor

VBA - Current Selection Box

Hello, 

I'd need to have the selected field-selection pairs from the activesheets current selection box, however I could not manage to access to the CS boxes through ActiveDocument.Activesheet.GetCurrentSelections.

I tried the below in Qlik and got an "object required" error + in python with COM, the result was an empty tuple.

sub d

x = ActiveDocument.ActiveSheet.GetCurrentSelections // tried with set x too..
s = x.Selections
v = x.VarId
for i = lbound(s) to ubound(s)
msgbox v(i)&" = "&s(i)
next
end sub

 

Any help is appreciated,

thx, 

2 Replies
Frank_Hartmann
Master II
Master II

try this:

 

sub d
x = ActiveDocument.GetCurrentSelections 
s = x.Selections
v = x.VarId
for i = lbound(s) to ubound(s)
msgbox v(i)&" = "&s(i)
next
end sub

 

LaIs
Contributor
Contributor
Author

I tried, but the result is not the active sheets current selection box, but the first sheets selections. I suppose there is a reason why we have activesheet.getcurrentselection separately in the API guide?

Actually what I dont understand is why I get the object required error, as I have the same code as in the guide

LaIs_0-1610200148370.png