Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Add/Delete element from container via macro

Can I Add/Delete element from container object via macro vbscript?

1 Solution

Accepted Solutions
m_woolf
Master II
Master II

It appears that the ContainedObjects member has a RemoveAt method. I can find no examples in the API for this, but there are examples for the Add method.

Set ContainerObj = ActiveDocument.Sheets("Main").CreateContainer

set ContProp=ContainerObj.GetProperties

ContProp.ContainedObjects.Add

ContProp.SingleObjectMode=1

ContProp.SingleObjectStyle=1

ContProp.ShowObjectTypeIcons=true

ContProp.ContainedObjects.Add

ContProp.ContainedObjects.Item(0).Id = "Document\CH03"

ContProp.ContainedObjects.Item(0).Text.v = "Bar"

ContainerObj.SetProperties ContProp

You might try something like:

ContProp.ContainedObjects.RemoveAt(0)

View solution in original post

1 Reply
m_woolf
Master II
Master II

It appears that the ContainedObjects member has a RemoveAt method. I can find no examples in the API for this, but there are examples for the Add method.

Set ContainerObj = ActiveDocument.Sheets("Main").CreateContainer

set ContProp=ContainerObj.GetProperties

ContProp.ContainedObjects.Add

ContProp.SingleObjectMode=1

ContProp.SingleObjectStyle=1

ContProp.ShowObjectTypeIcons=true

ContProp.ContainedObjects.Add

ContProp.ContainedObjects.Item(0).Id = "Document\CH03"

ContProp.ContainedObjects.Item(0).Text.v = "Bar"

ContainerObj.SetProperties ContProp

You might try something like:

ContProp.ContainedObjects.RemoveAt(0)