Over the summer I was asked if it was possible to have some of the reporting lines a different pattern. An interesting idea, but how do you mantain the feature when the Orgchart is imported and exported?
For this feature to work the information had to be stored with the person at the bottom of the reporting relationship. The Custom Properties (Soon to be Shape Data) of each person was preserved over imports and exports and was the ideal location. So once the data was imported into Visio VBA code was run to check each 2d shape for a "Reporting Type" Custom Property and change the line pattern of their reporting line to match.
' Display connections on the page
Dim conObj As Visio.Connect
Dim i As Integer
Dim ReportingType As String
Dim vsoPage As Visio.Page
Dim VsoShp As Visio.Shape
For Each vsoPage In ActiveDocument.Pages
For Each VsoShp In vsoPage.Shapes
If Not VsoShp.OneD Then
nrows = VsoShp.RowCount(Visio.visSectionProp)
For i = 0 To nrows – 1
If VsoShp.CellsSRC(Visio.visSectionProp, i, visCustPropsLabel).ResultStr(Visio.visNone) = "ReportingType" Then
ReportingType = VsoShp.CellsSRC(Visio.visSectionProp, i, visCustPropsValue).ResultStr(Visio.visNone)
For Each conObj In VsoShp.FromConnects
If conObj.FromPart = visEnd Then
Debug.Print "change to –> "; ReportingType
Select Case ReportingType
conObj.FromSheet.CellsSRC(visSectionObject, visRowLine, visLinePattern).FormulaU = "3"
conObj.FromSheet.CellsSRC(visSectionObject, visRowLine, visLinePattern).FormulaU = "2"
This can be taken further by trapping any changes to the line pattern through the UI and updating the Custom Property to match.
John… Visio MVP