Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

Store OBJECTID in a variable

Hi All,

In the enclosed sample file, I have few objects which need to be "send to excel with caption".
We have the macro for the same which works fine for an object whose objectID is hardcoded in the macro.

The requirement is I need to pass the OBJECTID of the selected chart (one at a time) to the macro through a variable.

Appreciate if someone suggest how do we achieve this?



1 Reply
Valued Contributor II

Re: Store OBJECTID in a variable

The following code will iterate over every object on a sheet and tell you which objects are active BUT the problem is when you click a button to trigger the macro, the button becomes the sole active object!!


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

    if objs(i).IsActive then msgbox objs(i).getObjectId & " is active"


... not sure if assigning the macros to the menu bar (Macro 1, Macro 2, Macro 3) would fix this, but you also have the issue if multiple objects are selected.

Perhaps you could place all your charts into a container and use the following to identify the chosen chart ...

set ContainerObj = ActiveDocument.GetSheetObject("CT01")

    Set ContProp = ContainerObj.GetProperties


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

The example in APIGuide shows it should be possible to identify the ActiveObject Id (ContProp.ContainedObjects.Item(0).Id) but this doesn't work in QV11 it seems, you might need to put the actual object ID via the container properties object labels (Objects Displayed in Container).


Community Browser