Microsoft KB Archive/254206
Article ID: 254206
Article Last Modified on 5/26/2005
This article was previously published under Q254206
You can change the path of a dynamic connector by dragging midpoints and vertices. If you want to reset the connector's path, you can change ShapeSheet cells that control routing. This article explains how to do so, and includes sample Visual Basic for Applications code that you can use to create a macro that does this.
TIP: The procedures in this article require knowledge of the ShapeSheet window or Visual Basic for Applications. These procedures are not supported by Microsoft Technical Support. If you want to reset a connector's path without using the ShapeSheet window, simply drop a placeable shape on top of the connector, and then delete the shape. Many 2-D shapes are placeable by default. For more information, search on the word "placeable" using Visio Help.
Resetting a Dynamic Connector's Path
The value 1024 in the Misc.ObjBehavior cell of a dynamic connector's ShapeSheet window (shown in the following picture) indicates that you changed the connector's path. To reset the connector's path, you must remove this value.
[GRAPHIC: Picture showing value to be removed]
To remove the value 1024 and reset a connector's path:
- In the Visio drawing, select the connector that you want to reset, and click Show ShapeSheet on the Windows menu.
- In the Miscellaneous section of the ShapeSheet window, do the following:
- Change the value in the ObjType cell to 0.
- Select the ObjBehavior cell, and press DELETE to remove the value 1024.
- Change the value in the ObjType cell back to 2.
The ObjType cell initially shows a value of 2; however, when ObjType is 2, Visio does not allow you to remove a value of 1024 from the ObjBehavior cell. Therefore, you must change the value of ObjType before changing ObjBehavior.
Sample Visual Basic for Applications Procedure
The following procedure steps though a selection of shapes and forces any dynamic connectors to recalculate their paths.
Public Sub ReCalcConnector() Dim visApp As Visio.Application Dim visSelection As Visio.Selection Dim visShape As Visio.Shape Dim i As Integer Set visApp = ThisDocument.Application Set visSelection = visApp.ActiveWindow.Selection 'Check the count in the collection. ' If visSelection.Count = 0 Then MsgBox "No Shape(s) selected.", vbOKOnly, "ReCalcConnector" Exit Sub End If For i = 1 To visSelection.Count 'Get the next item in the collection. ' Set visShape = visSelection(i) 'Check the shape type. ' If visShape.Master = "Dynamic connector" Then 'Force the dynamic connectors to recalculate their paths. ' visShape.Cells("ObjType").Formula = 0 visShape.Cells("ObjBehavior").Formula = 0 DoEvents visShape.Cells("ObjType").Formula = 2 End If Next i End Sub
Keywords: kbgraphxlinkcritical kbgraphxlink KB254206