How To Draw A Section Line In Autocad
I want to depict a line in autocad using excelvba. I tried the post-obit code but it requite some run time mistake displaying "object doesn't support this belongings or method" at the 2nd last line. Delight help me to fix this.
Dim point1(i To 3) As Double Dim point2(1 To 3) As Double Dim lineobj Equally Object Dim myapp As Object Dim AcadDwg Equally AcadDocument Sub access_autocad() On Fault GoTo ERRORHANDLER Set myapp = GetObject(, "autocad.application") ERRORHANDLER: If Err.Clarification <> "" Then Gear up myapp = CreateObject("autocad.awarding") End If myapp.Visible = True Set AcadDwg = myapp.ActiveDocument point1(ane) = 0: point1(2) = 0 point2(1) = 1: point2(ii) = 1 Set lineobj = AcadDwg.AddLine(point1, point2) End Sub asked Jul 27, 2017 at 18:42
MadhavMadhav
9 ane silverish badge 4 bronze badges
0
1 Answer one
You only demand to make one alter. On the side by side to last line, change:
Fix lineobj = AcadDwg.AddLine(point1, point2) To:
Gear up lineobj = AcadDwg.ModelSpace.AddLine(point1, point2) answered Jul 27, 2017 at 18:53
Brian Thou StaffordBrian G Stafford
7,670 2 gold badges 16 silverish badges 24 bronze badges
2
Not the reply you're looking for? Browse other questions tagged excel vba or ask your ain question.
Source: https://stackoverflow.com/questions/45358717/how-to-draw-a-line-in-autocad-using-excel-vba
Posted by: torreslitarly.blogspot.com

It works. Just i accept another problem. It works fine when i open autocad at outset and run this code. Simply it tin't automatically opens autocad when i run it without opening autocad. It have long time and cannot open at the end. I would very much appreciate it if yous could assist me here.
Jul 28, 2017 at five:34
The expert news is that your code works as expected on my machine. The bad news is I don't know exactly why it doesn't work on your machine. I accept seen this on occasion, though.
Jul 28, 2017 at 15:37