PDA

View Full Version : Need help regarding the connectors



Rathish
01-02-2013, 10:12 AM
Hi,
I need a help. Would like to know
Is there any way that i can change the connector's (line) size and colour. I am pasting the code below please help

Sub test_org()
Dim shpShapes As Shapes
Dim shpFirst As Shape
Dim shpSecond As Shape
Dim shpThrd As Shape
Dim shpfrth As Shape
Dim shpffth As Shape
Dim shpSxth As Shape
Dim shpSvnth As Shape
Dim shpetgh As Shape
Dim shpninth As Shape
Dim shpTnth As Shape


Set shpShapes = ActivePresentation.Slides(1).Shapes

'First Shape
Set shpFirst = shpShapes.AddShape(Type:=msoShapeRectangle, _
Left:=300, Top:=50, Width:=200, Height:=100)
'First Level First Shape
Set shpSecond = shpShapes.AddShape(Type:=msoShapeRectangle, _
Left:=50, Top:=200, Width:=200, Height:=100)
With shpShapes.AddConnector(Type:=msoConnectorElbow, BeginX:=0, _
BeginY:=0, EndX:=100, EndY:=100).ConnectorFormat
.BeginConnect ConnectedShape:=shpFirst, ConnectionSite:=3

.EndConnect ConnectedShape:=shpSecond, ConnectionSite:=1
End With




'First Level Second Shape
Set shpThrd = shpShapes.AddShape(Type:=msoShapeRectangle, _
Left:=300, Top:=200, Width:=200, Height:=100)

With shpShapes.AddConnector(Type:=msoConnectorElbow, BeginX:=0, _
BeginY:=0, EndX:=100, EndY:=100).ConnectorFormat
.BeginConnect ConnectedShape:=shpFirst, ConnectionSite:=3
.EndConnect ConnectedShape:=shpThrd, ConnectionSite:=1

End With



'First Level Third Shape
Set shpfrth = shpShapes.AddShape(Type:=msoShapeRectangle, _
Left:=550, Top:=200, Width:=200, Height:=100)
With shpShapes.AddConnector(Type:=msoConnectorElbow, BeginX:=0, _
BeginY:=0, EndX:=100, EndY:=100).ConnectorFormat
.BeginConnect ConnectedShape:=shpFirst, ConnectionSite:=3
.EndConnect ConnectedShape:=shpfrth, ConnectionSite:=1
End With







'Second Level First Shape
Set shpffth = shpShapes.AddShape(Type:=msoShapeRectangle, _
Left:=50, Top:=350, Width:=90, Height:=100)
With shpShapes.AddConnector(Type:=msoConnectorElbow, BeginX:=0, _
BeginY:=0, EndX:=100, EndY:=100).ConnectorFormat
.BeginConnect ConnectedShape:=shpSecond, ConnectionSite:=3
.EndConnect ConnectedShape:=shpffth, ConnectionSite:=1

End With

'Second Level Second Shape
Set shpSxth = shpShapes.AddShape(Type:=msoShapeRectangle, _
Left:=160, Top:=350, Width:=90, Height:=100)
With shpShapes.AddConnector(Type:=msoConnectorElbow, BeginX:=0, _
BeginY:=0, EndX:=100, EndY:=100).ConnectorFormat
.BeginConnect ConnectedShape:=shpSecond, ConnectionSite:=3
.EndConnect ConnectedShape:=shpSxth, ConnectionSite:=1

End With

'Second Level Third Shape
Set shpSvnth = shpShapes.AddShape(Type:=msoShapeRectangle, _
Left:=300, Top:=350, Width:=90, Height:=100)
With shpShapes.AddConnector(Type:=msoConnectorElbow, BeginX:=0, _
BeginY:=0, EndX:=100, EndY:=100).ConnectorFormat
.BeginConnect ConnectedShape:=shpThrd, ConnectionSite:=3
.EndConnect ConnectedShape:=shpSvnth, ConnectionSite:=1

End With


'Second Level Fourth Shape
Set shpetgh = shpShapes.AddShape(Type:=msoShapeRectangle, _
Left:=410, Top:=350, Width:=90, Height:=100)
With shpShapes.AddConnector(Type:=msoConnectorElbow, BeginX:=0, _
BeginY:=0, EndX:=100, EndY:=100).ConnectorFormat
.BeginConnect ConnectedShape:=shpThrd, ConnectionSite:=3
.EndConnect ConnectedShape:=shpetgh, ConnectionSite:=1

End With



'Second Level Fifth Shape
Set shpninth = shpShapes.AddShape(Type:=msoShapeRectangle, _
Left:=550, Top:=350, Width:=90, Height:=100)
With shpShapes.AddConnector(Type:=msoConnectorElbow, BeginX:=0, _
BeginY:=0, EndX:=100, EndY:=100).ConnectorFormat
.BeginConnect ConnectedShape:=shpfrth, ConnectionSite:=3
.EndConnect ConnectedShape:=shpninth, ConnectionSite:=1

End With

'Second Level Sixth Shape
Set shpTnth = shpShapes.AddShape(Type:=msoShapeRectangle, _
Left:=660, Top:=350, Width:=90, Height:=100)
With shpShapes.AddConnector(Type:=msoConnectorElbow, BeginX:=0, _
BeginY:=0, EndX:=100, EndY:=100).ConnectorFormat
.BeginConnect ConnectedShape:=shpfrth, ConnectionSite:=3
.EndConnect ConnectedShape:=shpTnth, ConnectionSite:=1

End With











'.Parent.RerouteConnections



End Sub

John Wilson
01-03-2013, 03:08 AM
Try this:

With shpShapes.AddConnector(Type:=msoConnectorElbow, BeginX:=0, _
BeginY:=0, EndX:=100, EndY:=100)
.Line.ForeColor.RGB = RGB(255, 0, 0)
.ConnectorFormat.BeginConnect ConnectedShape:=shpFirst, ConnectionSite:=3
.ConnectorFormat.EndConnect ConnectedShape:=shpSecond, ConnectionSite:=1
End With