Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Error Object doesn't support this property or method

Hi,

As I am trying to get the list box object values in a variable but it says "Object doesn't support this property or method

Please help

sub pressa

Set doc = ActiveDocument

Set b = doc.GetSheetObject("LB08")

msgbox (b)

end sub

Regards

Chriss

1 Solution

Accepted Solutions
Not applicable
Author

How u group them five employee?

Do u have any field for that?

If ur employee id as below

EmpId

100

101

102

103

104

105

then U can write a Macro like

Activedocument.Fields("EmpId").Select ">105"

or

sub pressa

Set doc = ActiveDocument.GetSheetObject("LB02")

boxvalues = doc.GetPossibleValues


for i = lbound(boxvalues) to ubound(boxvalues)

     if(i<5) then
   ActiveDocument.Fields(
"FieldName").ToggleSelect boxvalues(i)

     end if
next

Call ExportToExcel
   Doc.clear

end sub

Regards,

Kabilan K.

View solution in original post

11 Replies
Not applicable
Author

yes, we can't show the object in a Msg box, So use below macro,

sub pressa

Set doc = ActiveDocument.GetSheetObject("LB02")

boxvalues = doc.GetPossibleValues

for i = lbound(boxvalues) to ubound(boxvalues) 

    msgbox(boxvalues(i))

next

end sub

Regards,

Kabilan K.

Not applicable
Author

Thanks Kabilan and Kaushik,

Now I can read the value....

Regards

Chriss

Not applicable
Author

Hi Kabilan

As I need one more clarification in the script, now as in the list box first value should be selected and call the another procedure to run and then next i value selected, like the same I am trying, when I try doc.Selected, which I am getting a error of "Object doesn't support this property or method.

Please help

Regards

Chriss

Sub SelectCustomer()

Set doc = ActiveDocument.GetSheetObject("LB08")

boxvalues = doc.GetPossibleValues

For i = LBound(boxvalues) To UBound(boxvalues)

  ' msgbox(boxvalues(i))

  doc.Selected

  

Call ExportToExcel

Next

End Sub

Not applicable
Author

Use below script.

sub pressa

Set doc = ActiveDocument.GetSheetObject("LB02")

boxvalues = doc.GetPossibleValues

for i = lbound(boxvalues) to ubound(boxvalues) 

   ActiveDocument.Fields("FieldName").Select boxvalues(i)

   Call ExportToExcel

   Doc.clear

next

end sub

Regards,

Kabilan K.

Not applicable
Author

Hi Kabilan,

Thanks for your reply, I have almost acomplised the requirement and one final request is in the "FieldName", i have multiple values to be selected, so I concatenated the two fields in a listbox but when I try to do in the script, it shows error.

could you pleas check the attached ...

Thanks for your help.

Regards

Chriss

Not applicable
Author

U can concate the two field in script edidor like below.

Load Emp_id&'-'&Emp_Subid as Concate_field

          ,*

From Sample.qvd;

And u can use this field(Concate_field) in a Macro.

Regards,

Kabilan K.

Not applicable
Author

Hi Kabilan,

Thanks for your valuable help, it works as expected, what i requested and Is it possble to pass the "FieldName" value in a text file.

For instance I can create a individual report based on Emp_id&'-'&Emp_Subid, that is fine but as I need to generate a group of five employees in a one report for this I need a automatic selection of five employees Emp_id&'-'&Emp_Subid.

Is it possible....

Regards

Chriss

Not applicable
Author

How u group them five employee?

Do u have any field for that?

If ur employee id as below

EmpId

100

101

102

103

104

105

then U can write a Macro like

Activedocument.Fields("EmpId").Select ">105"

or

sub pressa

Set doc = ActiveDocument.GetSheetObject("LB02")

boxvalues = doc.GetPossibleValues


for i = lbound(boxvalues) to ubound(boxvalues)

     if(i<5) then
   ActiveDocument.Fields(
"FieldName").ToggleSelect boxvalues(i)

     end if
next

Call ExportToExcel
   Doc.clear

end sub

Regards,

Kabilan K.

Not applicable
Author

Hello Kabilan,

Thanks for your valuable support, I have linked my realtime schenorio which is attached in the qvw file.

Could you please look and advise me is that is possible.

Many Thanks and Regards

Chriss