Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
As in subject.
I have go thru the API guide but with no luck.
This looks like your question:
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"
ContProp.ContainedObjects.Add
ContProp.ContainedObjects.Item(1).Id = "Document\CH01"
ContProp.ContainedObjects.Item(1).Text.v = "Mekko"
ContainerObj.SetProperties ContProp
- Marcus
Thanks Marcus.
I have seen this code and have been playing with it but I'm getting error
Object doesn't support this property or method: 'ContProp.ContainedObjects.tem'
under this line
ContProp.ContainedObjects.Item(0).Id = "Document\CH03
I have been trying solution from this post but it has not helped
Any suggestions?
For me it worked with qv 10 fine unless the grid-style which qv 10 didn't have but in qv 11 you will find some grid-options within the api. Have you looked that you have an object with the id "Document\CH03" and you could also try it without the document-prefix "CH03".
- Marcus
Still no luck Marcus.
Would you mind to point me in out in the right direction to find the Grid member for the container in the API file?
If I tried this in qv 11 it worked:
sub x
Set ContainerObj = ActiveDocument.Sheets("Automation Examples").CreateContainer
set ContProp=ContainerObj.GetProperties
ContProp.ContainedObjects.Add
ContProp.SingleObjectMode=1
ContProp.SingleObjectStyle=1
ContProp.ShowObjectTypeIcons=true
ContProp.ContainedObjects.Add
ContProp.ContainedObjects.Item(0).Def.ObjectId = "Document\TX29"
ContProp.ContainedObjects.Item(0).Text.v = "Bar"
ContProp.ContainedObjects.Add
ContProp.ContainedObjects.Item(1).Def.ObjectId = "Document\LB22"
ContProp.ContainedObjects.Item(1).Text.v = "Mekko"
ContainerObj.SetProperties ContProp
end sub
And here are the grid-options. Unfortunately there are no examples for so it will be an ugly trial & error game
- Marcus
Sub Export
Chart1="Document\CH04"
Chart2="Document\CH02"
TargetFile="c:\aps\Container.png"
Call ExportContainer(Chart1,Chart2,TargetFile)
End Sub
Sub ExportContainer(Chart1,Chart2,TargetFile)
set ContainerObj = ActiveDocument.Sheets("Main").CreateContainer
set ContProp=ContainerObj.GetProperties
ContProp.ContainedObjects.Add
ContProp.Mode=1
ContProp.GridColumns=2
ContProp.GridRows=1
ContProp.ShowObjectTypeIcons=true
ContProp.ContainedObjects.Add
ContProp.ContainedObjects.Item(0).Def.ObjectId = Chart1
ContProp.ContainedObjects.Item(0).Text.v =Chart1
ContProp.ContainedObjects.Add
ContProp.ContainedObjects.Item(1).Def.ObjectId =Chart1
ContProp.ContainedObjects.Item(1).Text.v = Chart1
ContainerObj.SetProperties ContProp
ActiveDocument.GetApplication.WaitForIdle
ContainerObj.ExportBitmapToFile TargetFile
ContainerObj.Close
End Sub