Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

API in VB

HI

Can anyone advise how to make selections using API via VB? 

To date I have the below to open a file, refresh it, select the LIstbox i want to make the selection in but i cant get the IArrayOfRect Add methdo to work??  I can get it to Select all but i would like to eb able to specify a single select.

       

Dim QvApp As New QlikView.Application

     

Dim QVDoc As New QlikView.Document

QVDoc = QvApp.OpenDoc("C:\pgrp.qvw")

QVDoc.ReloadEx()


Dim sel As QlikView.ListBox

sel = QVDoc.GetSheetObject("LB02")

Dim pband As QlikView.IArrayOfRect

pband.Add("M")

sel.GeneralSelect(pband)

sel.SendToExcel()


QVDoc.CloseDoc()


QvApp.Quit()

Cheers

Mark

1 Solution

Accepted Solutions
mwoolf
Honored Contributor II

Re: API in VB

LB02 is not a field. Replace the LB02 with the fieldname that is displayed in the listbox

4 Replies
mwoolf
Honored Contributor II

Re: API in VB

What field is displayed in the listbox?

To select in a field:

Activedocument.fields("Fieldname").Select "M*"

In the API Guide you might also lookup ToggleSelect and SelectExcluded

Not applicable

Re: API in VB

Thanks for reply

I tried ...

QVDoc.Fields("LB02").Select("M*")

but i get an error stating that the object referenece is not set to an instance of an object

mwoolf
Honored Contributor II

Re: API in VB

LB02 is not a field. Replace the LB02 with the fieldname that is displayed in the listbox

Not applicable

Re: API in VB

thats it, so simple

I assumed it would use the ID, guess it is one of the read the def 'fieldname' !!

cheers