Public Function GetVertexCount(ByVal objPLine As AcadEntity) As Long If TypeOf objPLine Is AcadLWPolyline Then GetVertexCount = (UBound(objPLine.Coordinates) + 1) / 2 ElseIf TypeOf objPLine Is AcadPolyline Then GetVertexCount = (UBound(objPLine.Coordinates) + 1) / 3 End If End Function