Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Can I Add/Delete element from container object via macro vbscript?
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)
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)