b2b2 Posted May 11, 2019 Share Posted May 11, 2019 Hi all, i have small problem i am new in VBA and i am trying to write easy script in excel vba... i want to make a polyline from points i use this syntax, i cant find mistake but when i run macro it show me error 91 Can someone help me, thanks a lot Sub pline() Dim plineObj As AcadLWPolyline Dim Points(0 To 15) As Double Dim AcadDwg As AcadDocument 'Define the polyline Coordinates XY, XY, XY ..... Points(0) = 0: Points(1) = 0 Points(2) = 1: Points(3) = 1 Points(4) = 5: Points(5) = 3 Points(6) = 4: Points(7) = 6 Points(8) = 8: Points(9) = 8 Points(10) = 20: Points(11) = 0 Points(12) = 25: Points(13) = 5 Points(14) = 100: Points(15) = 100 ' Create a lightweight Polyline object in model space Set plineObj = AcadDwg.ModelSpace.AddLightWeightPolyline(Points) End Sub Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 12, 2019 Share Posted May 12, 2019 A google revealed a subtle difference, Works now. Just a comment if your going to make a sub pline then it would be better to make the number of points non fixed and pass to the function X & Y & Z as required. Note requires a minimum of 2 points. I do most in lisp so sorry. Set plineObj = AcadDwg.ModelSpace.AddLightWeightPolyline(Points) try Set plineObj = Thisdrawing.ModelSpace.AddLightWeightPolyline(Points) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.