Help with acad VBA

Feb 10, 2004 1 Replies

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


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...

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required