object variable or with block variable not set

Hi to all. I am new to macros and vba, i want to make a script that generate some lines from selected nodes. Here is my code:

Sub Macro()
    Dim nr As New NodeRange
    Dim n As Node
    Dim ghid As Shape
   
    If ActiveShape Is Nothing Then
        MsgBox "Selecteaza intai Gheorghe, care esti tu Gheorghe", vbCritical
        Exit Sub
    End If
   
    If ActiveShape.Type & lt > cdrCurveShape Then
        MsgBox "Please select a curve", vbCritical
        Exit Sub
    End If
   
    If ActiveShape.Curve.Selection.Count = 0 Then
        MsgBox "Selecteaza unul sau mai multe noduri pt crearea ghidelor", vbCritical
        Exit Sub
    End If
   
    For Each n In ActiveShape.Curve.Selection
    ghid.Fill.ApplyNoFill
    ghid.Outline.SetProperties 0.003, OutlineStyles(0), CreateCMYKColor(0, 0, 0, 100), ArrowHeads(0), ArrowHeads(0), cdrFalse, cdrFalse, cdrOutlineButtLineCaps, cdrOutlineMiterLineJoin, 0#, 100, MiterLimit:=45#
    ghid.Move 0.731827, 0#
       
       
        'nr.AddRange n.SubPath.Nodes.All
    Next n
   
    ' Now create selection of all selected subpaths
    'nr.Move 2, 0
End Sub

Some of it i recorded and some i found online.

Thank you.