connection points

D

David Kung

In Visio VBA, given a conneciton point how do I get the Connect object whose
endpoint is connected to the conneciton point?
Thanks
 
M

Mark Nelson [MS]

Connect objects are properties of Shapes, so you start with a Visio shape
object. The Connects collection on the shape lists all the connections to
the shape. Iterate through the Connect objects in the collection and check
the ToCell property to locate the specific connection point you are
interested in. Then check the FromSheet property of that Connect object to
get the connector glued to the connection point.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

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

Shahzad Godil

Checkout this function. Because of late bind, enumerator orignal value are
written here instead of orignal enum. This is returning connection point
collection. In case of any query, contact me on my msn messenger
([email protected])

Thanks
Shahzad Godil
Karachi-Pakistan

' Get the collection of link points from shape line
Private Function GetLinkPoints(objShape As Object) As Collection

On Error GoTo ErrorHandler

' Get first point of link
Set GetLinkPoints = New Collection
Dim objPoint As New SigmaFlowV2.point
objPoint.x = ConvertToTwips(objShape.CellsSRC(1, 4, 0))
objPoint.Y = GetReverseYPoint(objShape.CellsSRC(1, 4, 1)) -
GetFirstDepartmentTop
GetLinkPoints.Add objPoint
Set objPoint = Nothing

' Get all points from second to second last point
Dim n As Integer

objShape.Cells("ConLineJumpCode") = 1
For n = 1 To objShape.Section(10).Count - 3 ' visSectionFirstComponent =
10

Set objPoint = New SigmaFlowV2.point

objPoint.x = ConvertToTwips(objShape.Section(10).Row(1 + n).Cell(0)
+ objShape.CellsSRC(1, 4, 0) - objShape.Section(10).Row(1).Cell(0))
objPoint.Y = GetReverseYPoint(objShape.Section(10).Row(1 +
n).Cell(1) + objShape.CellsSRC(1, 4, 1) -
objShape.Section(10).Row(1).Cell(1)) - GetFirstDepartmentTop

GetLinkPoints.Add objPoint
Set objPoint = Nothing

Next

' Get last point of link
Set objPoint = New SigmaFlowV2.point
objPoint.x = ConvertToTwips(objShape.CellsSRC(1, 4, 2))
objPoint.Y = GetReverseYPoint(objShape.CellsSRC(1, 4, 3)) -
GetFirstDepartmentTop

GetLinkPoints.Add objPoint

Set objPoint = Nothing

Exit Function

ErrorHandler:
GblWriteLog "SFVisioImport", "GetLinkPoints", "D"


End Function
 

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