Help with acad VBA

Hello Group ive been a cad user for a few years and now I'm trying to get my head around acad VBA. I have bought mastering AutoCAD VBA by Sybex.

when I try to run listing 16.2 I get the following error

Compile error: User-defined type not defined.

the following is the code I am trying to run

Option Explicit

Public Sub DrawAutoCADLine() 'sending line data to AutoCAD Dim AutoCADApplication As AutoCAD.Application Dim StartLine(0 To 2) As Double Dim EndLine(0 To 2) As Double Set AutoCADApplication = CreateObject("AutoCAD.Application") StartLine(0) = Cells(2, 2).Value StartLine(1) = Cells(3, 2).Value EndLine(0) = Cells(2, 3).Value EndLine(1) = Cells(3, 3).Value AutoCADApplication.ActiveDocument.ModelSpace.AddLine StartLine, EndLine End Sub

is there something wrong with the code or am I doing something wrong myself ?

TIA Dave

Reply to
dc
Loading thread data ...

Provided that 'Cells' is defined somewhere else, the following should be OK:

Public Sub DrawAutoCADLine() 'sending line data to AutoCAD Dim AutoCADApplication As Object ....

Ben

"dc" schreef in bericht news:7rdWb.1526$ snipped-for-privacy@news-text.cableinet.net...

Reply to
Ben

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.