In Visio 2010, the default connection point is Inward. Despite my recent findings on Visio, I can’t find any method to change the default connection point to In-Out. Facing this kind of situation, we can always rely on Macro to help our cause.
First, let’s enable the Developer Mode. Without this, we can’t add our macro codes. Click File → Options → Advanced, then scroll all the way down.
After we clicked OK, we can press Alt-F11 to open the Visual Basic editor. Double-click ThisDocument to active the source code editor, then paste below code:
Sub ConnectPtsAllInOut() 'Enable diagram services Dim DiagramServices As Integer DiagramServices = ActiveDocument.DiagramServicesEnabled ActiveDocument.DiagramServicesEnabled = visServiceVersion140 Dim UndoScopeID1 As Long UndoScopeID1 = Application.BeginUndoScope("Inward and Outward") Dim vsoRow1 As Visio.Row Dim ctr, ctr2 As Integer Dim Sections As Object 'Array starts from 1 For ctr = 1 To Application.ActiveWindow.Page.Shapes.Count 'Ensure the Shape has connection points Array On Error Resume Next Set Sections = Application.ActiveWindow.Page.Shapes(ctr).Section(visSectionConnectionPts) If Err.Number = 0 Then 'Inconsistently, now array starts from 0 For ctr2 = 0 To Application.ActiveWindow.Page.Shapes(ctr).Section(visSectionConnectionPts).Count - 1 Set vsoRow1 = Application.ActiveWindow.Page.Shapes(ctr).Section(visSectionConnectionPts).Row(ctr2) vsoRow1.Cell(visCnnctType).FormulaU = visCnnctTypeInwardOutward Next End If Next Application.EndUndoScope UndoScopeID1, True 'Restore diagram services ActiveDocument.DiagramServicesEnabled = DiagramServices End Sub
I hope it helps. Cheers!
loading...
About Hardono
Incoming Search
microsoft, vba, visio
how to change all element at a go , this script works when you drag and drop that element to the canvas