Here is a more formalized version of my earlier post.

I have annotated the example.

My first example was off the top of my head and was not checked for errors, this time I error checked the code.

Enjoy,

CWC

`'**********************************************************************************************************`

'**********************************************************************************************************

' Subroutene......: DemonstrateXL2Tcad

' Description.....: Sets up Cells (Row and Column Values) to store Vertex Values

' : Calls the TCadLine Function to place a line into the Active TurboCad Drawing

' : Calls a message box to tell you whether the call to the TCadLine Function worked

'

' Requires........: TCad to be active with a blank drawing

' : The Active Sheet of Excel to be blank

'

' Arguments.......: None

'

' Returns.........: A Line is placed in the active drawing of TCad

'**********************************************************************************************************

'**********************************************************************************************************

Sub DemonstrateXL2Tcad()

Dim wksWKS As Excel.Worksheet

Dim boolDidItWork As Boolean

Dim RowX1 As Long

Dim ColumnX1 As Integer

Dim RowY1 As Long

Dim ColumnY1 As Integer

Dim RowZ1 As Long

Dim ColumnZ1 As Integer

Dim RowX2 As Long

Dim ColumnX2 As Integer

Dim RowY2 As Long

Dim ColumnY2 As Integer

Dim RowZ2 As Long

Dim ColumnZ2 As Integer

Dim X1 As Double

Dim Y1 As Double

Dim Z1 As Double

Dim X2 As Double

Dim Y2 As Double

Dim Z2 As Double

Set wksWKS = Excel.Application.ActiveSheet

'make up some values for the Excel Cell Coordinates (rows and columns)

RowX1 = 1

ColumnX1 = 1

RowY1 = 1

ColumnY1 = 2

RowZ1 = 1

ColumnZ1 = 3

RowX2 = 2

ColumnX2 = 1

RowY2 = 2

ColumnY2 = 2

RowZ2 = 2

ColumnZ2 = 3

'make up some values for the Coordinates and place them in Excel

wksWKS.Cells(RowX1, ColumnX1) = 10

wksWKS.Cells(RowY1, ColumnY1) = 20

wksWKS.Cells(RowZ1, ColumnZ1) = 0

wksWKS.Cells(RowX2, ColumnX2) = 30

wksWKS.Cells(RowY2, ColumnY2) = 40

wksWKS.Cells(RowZ2, ColumnZ2) = 0

'retreive the coordinates from excel

X1 = wksWKS.Cells(RowX1, ColumnX1)

Y1 = wksWKS.Cells(RowY1, ColumnY1)

Z1 = wksWKS.Cells(RowZ1, ColumnZ1)

X2 = wksWKS.Cells(RowX2, ColumnX2)

Y2 = wksWKS.Cells(RowY2, ColumnY2)

Z2 = wksWKS.Cells(RowZ2, ColumnZ2)

'send the coordinates to the line Function

boolDidItWork = TCadLine(X1, Y1, Z1, X2, Y2, Z2)

If boolDidItWork = True Then

MsgBox "Yes, it worked"

ElseIf boolDidItWork = False Then

MsgBox "No, it did not work"

End If

'Clean up by releasing all objects

Set wksWKS = Nothing

End Sub 'DemonstrateXL2Tcad

'**********************************************************************************************************

'**********************************************************************************************************

' Subroutene......: TCadLine

' Description.....: Sets up Cells (Row and Column Values) to store Vertex Values

' : Calls the TCadLine Function to place a line into the Active TurboCad Drawing

' : Calls a message box to tell you whether the call to the TCadLine Function worked

'

' Requires........: TCad to be active with a blank drawing

' : The Active Sheet of Excel to be blank

'

' Arguments.......: X1 the "X" coordinate of the first vertex

' : Y1 the "Y" coordinate of the first vertex

' : Z1 the "Z" coordinate of the first vertex

' : X2 the "X" coordinate of the Second vertex

' : Y2 the "Y" coordinate of the Second vertex

' : Z2 the "Z" coordinate of the Second vertex

'

' Returns.........: True if the Line was placed in the active drawing of TCad

' : False if there was an error

'**********************************************************************************************************

'**********************************************************************************************************

Function TCadLine(X1 As Double, Y1 As Double, Z1 As Double, X2 As Double, Y2 As Double, Z2 As Double) As Boolean

Dim appIMSI As IMSIGX.Application

Dim drDr As IMSIGX.Drawing

Dim grGr As IMSIGX.Graphic

Dim grsGrs As IMSIGX.Graphics

On Error GoTo errTCadLine

TCadLine = False

Set appIMSI = GetObject(, "IMSIGX.Application") 'Get a reference to the TurboCad Application object

Set drDr = appIMSI.ActiveDrawing 'Get a reference to the TurboCad Active Drawing object

Set grsGrs = drDr.Graphics 'Get a reference to the Graphics Collection object of the Active drawingSet grGr = grsGrs.AddLineSingle(X0, Y0, 0, X1, Y1, 0) 'add a Graphic to the Graphics Collection of the Active drawing

Set grGr = grsGrs.AddLineSingle(X1, Y1, Z1, X2, Y2, Z2) 'Add a line (a Graphic) to the Graphic(s) collection

TCadLine = True

'Clean up by releasing all objects

errTCadLine:

Set grGr = Nothing

Set grsGrs = Nothing

Set drDr = Nothing

Set appIMSI = Nothing

End Function 'TCadLine