Thanks for the quick reply!
This is the code I use to open up the Excel file, and the loop I use to extract the first column of useful data from Excel, and into Auto CAD.
Dim excelapp As Excel.Application
Dim wbkobj As Workbook
Dim shtobj As Worksheet
Dim strtest As String
Dim Row As Double
Dim X as Double
Dim Y as Double
Dim talgn As AcAlignment
On Error Resume Next
frmImportCableSched.Hide
Err.Clear
Set excelapp = GetObject(, "Excel.Application")
If Err <> 0 Then
Err.Clear
Set excelapp = CreateObject("Excel.Application")
If Err <> 0 Then
MsgBox "couldn't start excel", vbExclamation
End
End If
End If
excelapp.Visible = False
'Open workbook from predetermined string sPath
Set wbkobj = Workbooks.Open(sPath)
Set shtobj = excelapp.Worksheets(1)
'Import First column with data into Auto CAD
Row = 16
Do While Row < 101
strtest = shtobj.Cells(Row, 2)
X = 51.86
Y = 520.5 - ((Row - 16) * 5)
talgn = acAlignmentMiddleCenter
modDwgTools.WriteKey aDwg, strtest, talgn, X, Y
Row = Row + 1
Loop
Here is the code accessed when the modDwgTools.WriteKey is called:
Public Function WriteKey(aDwg As AcadDocument, strtest As String, algn As AcAlignment, X As Double, Y As Double, Optional dblHeight As Double) As Boolean
Dim aSpace As AcadModelSpace
Dim tBase(2) As Double
Dim tDest(2) As Double
Dim aText As AcadText
Set aSpace = aDwg.ModelSpace
If dblHeight = 0 Then
dblHeight = 2.5
End If
Set aText = aSpace.AddText(strtest, tBase, dblHeight)
aText.Layer = "TEXT"
aText.Alignment = algn
tDest(0) = X
tDest(1) = Y
tDest(2) = 0
aText.Move tBase, tDest
End Function
So, this code allows me to get all the necessary data from Excel to Auto CAD. I was just wondering how I would go about doing a reversal of this process (I have some spreadsheets I need to get into acad, and some drawings I need to get into Excel.) If possible, I would like to continue to use VBA in Auto CAD. Thanks.