Connector Shape not correctly finding shape text for ToSheet prope

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
 
M

Mark Nelson [MS]

Answered in other newsgroup.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top