Hi Ashok,
I've written a small example macro for you. Hope it helps. The macro creates
two connection points: one at the top and one at the bottom of a shape named
"Sheet.1".
Best regards,
Markus
Public Sub CreateCP()
Dim myShape As Shape
Dim rowIndex As Integer
Dim myRow As Row
Dim myCell As Cell
' Get shape reference. Assumption: Shape name is "Sheet.1"
Set myShape = Visio.ActivePage.PageSheet.Shapes("Sheet.1")
' Create Connection Points Section (if it does not exist)
If (Not (myShape.SectionExists(Visio.visSectionConnectionPts, 1))) Then
myShape.AddSection (Visio.visSectionConnectionPts)
End If
' Add row for 1st connection point
rowIndex = myShape.AddRow(Visio.visSectionConnectionPts,
Visio.visRowConnectionPts, 0)
' Set X value of connection point
Set myCell = myShape.CellsSRC(Visio.visSectionConnectionPts,
Visio.visRowConnectionPts, 0)
myCell.Formula = "=Width/2"
' Set Y value of connection point
Set myCell = myShape.CellsSRC(Visio.visSectionConnectionPts,
Visio.visRowConnectionPts, 1)
myCell.Formula = "=0"
' Add row for 2nd connection point
rowIndex = myShape.AddRow(Visio.visSectionConnectionPts,
Visio.visRowConnectionPts + 1, 0)
' Set X value of connection point
Set myCell = myShape.CellsSRC(Visio.visSectionConnectionPts,
Visio.visRowConnectionPts + 1, 0)
myCell.Formula = "=Width/2"
' Set Y value of connection point
Set myCell = myShape.CellsSRC(Visio.visSectionConnectionPts,
Visio.visRowConnectionPts + 1, 1)
myCell.Formula = "=Height"
End Sub