Is it possible to create your own container from scratch? I have a number of objects that I would like to convert into containers.
Yes, quite simple.
If you add a container to a page and open the Drawing Explorer window (you will need to be in Developer mode) then open the shapesheet editor for this shape and you will see in contains a User-Defined section. This contains a cell called
msvStructureType
which has the value
"Container"
Add this same item to your shape and it will become a container.
Awesome thanks
Actually I have a couple of questions for you:
you created this beautiful piece of code a while back that would write to the connector the shapes the objects were connected to. I have some data that is connected to the objects from a an access database: i have a unique code called Prop.ObjectID on each object:
a) can you tell me how I can change the code so that it gets the objectID insted of the text. Also
b) is there anyway you know of to create one of these connectors automatically if I place one object inside of another.
Sub GetFlowchartConnections()
' Gets text from shapes connected at each end of every line on page
' Stores text in two shape data fields on each line
Dim pg As Visio.Page
Dim shp As Visio.Shape
Dim cnxEndPoints As Visio.Connects
Dim EP As Visio.Connect
Dim shpFrom As Visio.Shape
Dim shpTo As Visio.Shape
For Each pg In ActiveDocument.Pages
For Each shp In pg.Shapes
Call InitFromTo(shp)
' BeginX only exists if shape is a line
If shp.CellExists("BeginX", False) Then
'Get connects collection for current shape
Set cnxEndPoints = shp.Connects
If cnxEndPoints.Count > 0 Then
For i = 1 To cnxEndPoints.Count
Set EP = cnxEndPoints(i)
If EP.FromPart = visBegin Then
' Get shape this end is attached to
Set shpFrom = EP.ToSheet
' Store attached shape's text
shp.CellsU("Prop.From").FormulaU = Chr(34) & shpFrom.Text & Chr(34)
Else
' Get shape this end is attached to
Set shpTo = EP.ToSheet
' Store attached shape's text
shp.CellsU("Prop.To").FormulaU = Chr(34) & shpTo.Text & Chr(34)
End If
Next
End If
End If
Next
Next
End Sub
Sub InitFromTo(ByRef Shape As Visio.Shape)
' Create Prop.From/To if they don't exist
' Set both fields to null
If Not Shape.CellExistsU("Prop.From", False) Then
Shape.AddNamedRow visSectionProp, "From", visdefault
End If
Shape.CellsU("Prop.From").FormulaU = ""
If Not Shape.CellExistsU("Prop.To", False) Then
Shape.AddNamedRow visSectionProp, "To", visdefault
End If
Shape.CellsU("Prop.To").FormulaU = ""
End Sub
Not me. It doesn't belong in this thread anyway, could you repost it in the correct thread.
Thank you.