Sub créeShape(parent, niv, Attribut, Style) ' procédure récursive
'If parent = "1_9" Then colonne = "pb" '<---- erreur pour debug
colonne = colonne + 1
txt = parent & " : " & Attribut
If Style = "0" Then
hauteurshape = 25
largeurshape = 180
'erreur 70 v
Org.Shapes.AddTextbox(msoTextOrientationHorizontal, 10, 10, largeurshape, hauteurshape).name = parent
'erreur 70 ^
Org.Shapes(parent).Line.ForeColor.SchemeColor = 22
With Org.Shapes(parent)
.TextFrame.Characters.text = txt
.TextFrame.Characters(Start:=1, Length:=1000).Font.Size = 8
.TextFrame.Characters(Start:=1, Length:=Len(parent)).Font.Bold = True
.Fill.ForeColor.RGB = RGB(255, 255, 255)
.TextFrame.Characters(Start:=1, Length:=Len(parent)).Font.Color = vbRed
.TextFrame.Characters(Start:=1, Length:=Len(parent)).Font.Size = 6
End With
Else
hauteurshape = 45
largeurshape = 160
Org.Shapes.AddTextbox(msoTextOrientationHorizontal, 10, 10, largeurshape, hauteurshape).name = parent
Org.Shapes(parent).Line.ForeColor.SchemeColor = 8
With Org.Shapes(parent)
.TextFrame.Characters.text = txt
.TextFrame.Characters(Start:=1, Length:=1000).Font.Size = 8
.TextFrame.Characters(Start:=1, Length:=Len(parent)).Font.Bold = True
.Fill.ForeColor.RGB = RGB(255, 255, 255)
.TextFrame.Characters(Start:=1, Length:=Len(parent)).Font.Color = vbRed
.TextFrame.Characters(Start:=1, Length:=Len(parent)).Font.Size = 6
End With
End If
Org.Shapes(parent).Left = DebutOrg.Left + niv * inth
Org.Shapes(parent).Top = DebutOrg.Top + intv * colonne
Set VariableObjet = Nothing
For i = 2 To n
val01 = Tbd(i, 2)
val01 = CStr(val01)
If IsNumeric(val01) Then
lenght = Len(val01)
Else
lenght = InStr(StrReverse(val01), "_")
lenght = Len(val01) - lenght
End If
If Tbd(i, 2) = parent And niv > 1 Then
shapePère = Left(val01, lenght)
Org.Shapes.AddConnector(msoConnectorElbow, 100, 100, 100, 100).name = parent & "c"
Org.Shapes(parent & "c").Line.ForeColor.SchemeColor = 22
Org.Shapes(parent & "c").ConnectorFormat.BeginConnect Org.Shapes(shapePère), 3
Org.Shapes(parent & "c").ConnectorFormat.EndConnect Org.Shapes(parent), 2
End If
parent = CStr(parent)
Debug.Print parent & " et " & Left(val01, lenght)
If Left(val01, lenght) = parent Then créeShape Tbd(i, 2), niv + 1, Tbd(i, 1), Tbd(i, 3)
Next i
End Sub