title: How to draw a line in autocad using excel vba?
body: <blockquote>
    <p>I want to draw a line in autocad using excelvba. 
    I tried the following code but it give some run time error displaying "object doesn't support this property or method" at the 2nd last line.
    Please help me to fix this.</p>
  </blockquote>
  
  <pre><code>Dim point1(1 To 3) As Double
  Dim point2(1 To 3) As Double
  Dim lineobj As Object
  Dim myapp As Object
  Dim AcadDwg As AcadDocument
  
  Sub access_autocad()
  On Error GoTo ERRORHANDLER
  Set myapp = GetObject(, "autocad.application")
  
  ERRORHANDLER:
      If Err.Description &lt;&gt; "" Then
      Set myapp = CreateObject("autocad.application")
      End If
      myapp.Visible = True
  Set AcadDwg = myapp.ActiveDocument
  point1(1) = 0: point1(2) = 0
  point2(1) = 1: point2(2) = 1
  Set lineobj = AcadDwg.AddLine(point1, point2)
  
  End Sub
  </code></pre>