Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
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
Luminary Alumni
Luminary Alumni

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
Luminary Alumni
Luminary Alumni

Great.  Not given this in APIGuide.

Regards,

Jagan.