J
JanF
I have modified a connector shape to read the information in the ToSheet
properties of its connections and to populate custom properties called "From"
and "To".
When this connector glues to other shapes, it populates the ShapeText of its
two connected shapes into the corresponding properties.
When I modify any of the shapes the connector connects to, to use a custom
property as its ShapeText (by selecting the shape and clicking on Insert
Field and selecting the property whose value to display as ShapeText), then
my connector shape only displays a question mark as the corresponding shape's
ShapeText.
Please help.
The VBA code for the connector follows:
Public Sub CreateAssoc()
Dim VisSelSet As Visio.Selection
Set VisSelSet = Visio.ActiveWindow.Selection
Dim CurrentShape As Visio.Shape
Set CurrentShape = VisSelSet.Item(1)
Dim cnt As Visio.Connect
' make sure the shape selected is my connector and that is glued to two shapes
If CurrentShape.Master.ObjectType <> 12 Or CurrentShape.Connects.Count <> 2
Then
'clear custom properties
CurrentShape.Cells("Prop.From").Formula = "=" + Chr(34) + Chr(34)
CurrentShape.Cells("Prop.to").Formula = "=" + Chr(34) + Chr(34)
'and exit sub
Exit Sub
End If
'else
'for FROM custom property (first connect item)
Set cnt = CurrentShape.Connects.Item(1)
CurrentShape.Cells("Prop.From").Formula = "=" + Chr(34) +
cnt.ToSheet.Text + Chr(34)
'for TO custom property (second connect item)
Set cnt = CurrentShape.Connects.Item(2)
CurrentShape.Cells("Prop.To").Formula = "=" + Chr(34) + cnt.ToSheet.Text
+ Chr(34)
End Sub
properties of its connections and to populate custom properties called "From"
and "To".
When this connector glues to other shapes, it populates the ShapeText of its
two connected shapes into the corresponding properties.
When I modify any of the shapes the connector connects to, to use a custom
property as its ShapeText (by selecting the shape and clicking on Insert
Field and selecting the property whose value to display as ShapeText), then
my connector shape only displays a question mark as the corresponding shape's
ShapeText.
Please help.
The VBA code for the connector follows:
Public Sub CreateAssoc()
Dim VisSelSet As Visio.Selection
Set VisSelSet = Visio.ActiveWindow.Selection
Dim CurrentShape As Visio.Shape
Set CurrentShape = VisSelSet.Item(1)
Dim cnt As Visio.Connect
' make sure the shape selected is my connector and that is glued to two shapes
If CurrentShape.Master.ObjectType <> 12 Or CurrentShape.Connects.Count <> 2
Then
'clear custom properties
CurrentShape.Cells("Prop.From").Formula = "=" + Chr(34) + Chr(34)
CurrentShape.Cells("Prop.to").Formula = "=" + Chr(34) + Chr(34)
'and exit sub
Exit Sub
End If
'else
'for FROM custom property (first connect item)
Set cnt = CurrentShape.Connects.Item(1)
CurrentShape.Cells("Prop.From").Formula = "=" + Chr(34) +
cnt.ToSheet.Text + Chr(34)
'for TO custom property (second connect item)
Set cnt = CurrentShape.Connects.Item(2)
CurrentShape.Cells("Prop.To").Formula = "=" + Chr(34) + cnt.ToSheet.Text
+ Chr(34)
End Sub