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

Error in macro

From API Guide>>>

sub ActiveOBJ

Set ContainerObj = ActiveDocument.GetSheetObject("CT01")

set ContProp=ContainerObj.GetProperties

ActiveObject=ContProp.SingleObjectActiveIndex

  msgbox("Active Object=" & ActiveObject & "  Id=" & ContProp.ContainedObjects.Item(ActiveObject).Id)

end sub

But this is giving error

Object doesn't support this property or method: 'ContProp.ContainedObjects.Item(...).Id'

Can anyone resolve it....

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi Nitin,

I am not sure why it is not working, but the work around for this is

Create two variables

vIndex  : 1

vCurrentContainerObject : =Pick(vIndex + 1, 'CH01', 'CH02')  //CH01 and CH02 are objects in container

Macro:

Function Test

  Set ContainerObj = ActiveDocument.GetSheetObject("CT01")

  set ContProp=ContainerObj.GetProperties

  set v = ActiveDocument.GetVariable("vIndex")

     v.SetContent ContProp.SingleObjectActiveIndex ,true   

end function

Hope this helps you.

Regards,

jagan.

View solution in original post

8 Replies
v_iyyappan
Specialist
Specialist

Hi,

Please check below attached image for container macro.

Regards,

Anonymous
Not applicable
Author

Its not helping............

jagan
Luminary Alumni
Luminary Alumni

Hi Nitin,

I am not sure why it is not working, but the work around for this is

Create two variables

vIndex  : 1

vCurrentContainerObject : =Pick(vIndex + 1, 'CH01', 'CH02')  //CH01 and CH02 are objects in container

Macro:

Function Test

  Set ContainerObj = ActiveDocument.GetSheetObject("CT01")

  set ContProp=ContainerObj.GetProperties

  set v = ActiveDocument.GetVariable("vIndex")

     v.SetContent ContProp.SingleObjectActiveIndex ,true   

end function

Hope this helps you.

Regards,

jagan.

tresesco
MVP
MVP

Try like:

sub GetActiveIndex

Set ContainerObj= ActiveDocument.GetSheetObject("CT01")
Set ContProp=ContainerObj.GetProperties      
vActiveIndex="You clicked tab number: " & ContProp.SingleObjectActiveIndex
ActiveDocument.Variables("vActiveIndex").SetContent vActiveIndex, true
msgbox vActiveIndex


End Sub

Anonymous
Not applicable
Author

By this how how I will get the activated object id(CHRT ID)

jagan
Luminary Alumni
Luminary Alumni

Hi,

The variable vCurrentContainerObject will have the chart ID.  You need to assign the macro to a button when clicked on button you will get.

Regards,

Jagan.

Anonymous
Not applicable
Author

But why the example in API guide is giving me error, Any IDEA???

jagan
Luminary Alumni
Luminary Alumni

Not Sure Nitin, may be Community Adminstrator Sara Leslie can help in this. Not sure whether it is a bug, let them confirm.

Regards,

Jagan.