Connector not showing ShapeText in FromSheet / ToSheet
(too old to reply)
2007-11-27 20:56:00 UTC
I have modified the behaviour of a connector shape to populate two custom
properties called 'From' and 'To'

It works perfectly on any standard two shapes.

When I add custom properties to a shape, and have the default displayed text
for the shape reflect the value in one of the custom properties (by selecting
the shape and clicking on Insert Field, and selecting the custom property)
the previously modified connector shape only shows questionmarks in its
custom fields (ie in the underlying properties that the fields are set from.)

The connector code is as 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

' I need the shape to be my connector and it must be attached to two other
If CurrentShape.Master.ObjectType <> 12 Or CurrentShape.Connects.Count <> 2
'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
'for FROM custom property
Set cnt = CurrentShape.Connects.Item(1)
CurrentShape.Cells("Prop.From").Formula = "=" + Chr(34) +
cnt.ToSheet.Text + Chr(34)
'for TO custom property
Set cnt = CurrentShape.Connects.Item(2)
CurrentShape.Cells("Prop.To").Formula = "=" + Chr(34) + cnt.ToSheet.Text
+ Chr(34)

End Sub
2007-11-28 01:39:01 UTC
Everything look normal when i tryed .
Mark Nelson [MS]
2007-11-29 06:21:43 UTC
From the Help topic on the Text property of a Shape:

In the text returned by the Text property of a Shape object, fields are
represented by an escape character (30 (&H1E)) For example, if a Shape
object's text contains a field that displays the file name of a drawing, the
Shape object's Text property returns an escape character where that field is
inserted into the text. If you want the text to contain the expanded field,
get the shape's Characters property, and then get the Text property of the
resulting Characters object.
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
Post by JuneTheSecond
Everything look normal when i tryed .