How to get edge length thru API

..Please help me..

I would like get length of selected edge(Body edge.Refer Attached jpeg) using API...For that i have wrote some code but it giving me some error.Error code highlighted by red color..Please find the code below..

Sub main()

Dim doc As SldWorks.ModelDoc2

Dim part As SldWorks.PartDoc

Dim feat As SldWorks.Feature

Dim sketch As SldWorks.sketch

Dim v As Variant

Dim i As Long

Dim sseg As SldWorks.SketchSegment

Dim sline As SldWorks.SketchLine

Dim sp As SldWorks.SketchPoint

Dim ep As SldWorks.SketchPoint

Dim s As String

Dim boolstatus As Boolean

Dim swApp     As SldWorks.SldWorks

Dim swModel   As SldWorks.ModelDoc2

Dim swSelMgr  As SldWorks.SelectionMgr

Dim swSelObji  As Object

Dim swSkLine    As SldWorks.SketchLine

Dim bRet        As Boolean

Dim nDisti     As Double

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

Set swSelMgr = swModel.SelectionManager

    For i = 1 To 100

   

    Set swSelObji = swSelMgr.GetSelectedObject5(i)

    nDisti = swSelObji.GetLength

Set exApp = CreateObject("Excel.Application")

If Not exApp Is Nothing Then

  exApp.Visible = True

  If Not exApp Is Nothing Then

   Set exApp = GetObject(, "Excel.Application")

   Set Sheet = exApp.ActiveSheet

   End If

End If

Sheet.Cells(13, 4).Value = nDisti * 1000

Set exApp = GetObject(, "Excel.Application")

   Set Sheet = exApp.ActiveSheet

    Sheet.Cells(13, 1).EntireRow.Resize(1).Insert

Next i

End Sub


SolidworksApi macros