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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro to delete charts from container

Hi,

I have some n charts inside a container, I want to delete them by looping through all objects in the container.

Can someone tell me how to do this using a macro.

Thanks,

Jyotsna

1 Solution

Accepted Solutions
Not applicable
Author

Got it finally

Set ContainerObj = ActiveDocument.GetSheetObject("CT01")

Set ContProp = ContainerObj.GetProperties

for i=0 to ContProp.ContainedObjects.Count-1

ContProp.ContainedObjets.RemoveAt(0)

ContainerObj.SetProperties ContProp

next

Hope this helps someone

View solution in original post

4 Replies
jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this not sure it works.

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

set ContProp=ContainerObj.GetProperties

ContProp.ContainedObjects.Item(0).Remove

or

ContProp.ContainedObjects.Item(0).Delete

Regards,

Jagan.

Not applicable
Author

I tried all of Remove, Delete and Close, nothing seems to be working.

Thanks,

Jyotsna

Not applicable
Author

Got it finally

Set ContainerObj = ActiveDocument.GetSheetObject("CT01")

Set ContProp = ContainerObj.GetProperties

for i=0 to ContProp.ContainedObjects.Count-1

ContProp.ContainedObjets.RemoveAt(0)

ContainerObj.SetProperties ContProp

next

Hope this helps someone

jagan
Partner - Champion III
Partner - Champion III

Great.  Not given this in APIGuide.

Regards,

Jagan.