Here is a little routine you can try. It is no the best sample or a tutorial, but something simple to get you thinking. Create an Excel file and save it as "C:\My Documents\TestBook.xls", name the first WorkSheet "Test" and write something in cells B1:B8. Open AutoCAD create a new VBA project and write the following code in a code module or ThisDrawing object. Create a new drawing with the imperial template. Finally, run the routine. One more thing forgot, you also need to add reference to your excel application to the VBA project.
{code}Public Sub GetExcelInfo()
Dim exapp As Excel.Application
Dim wsheet As Excel.Worksheet
Dim cll As Excel.Range
Dim rg As Excel.Range
Dim pt(2) As Double
Set exapp = CreateObject("Excel.Application")
exapp.Visible = True
exapp.Workbooks.Open ("C:\My Documents\TestBook.xls")
Set wsheet = exapp.ActiveSheet
If wsheet.Name = "Test" Then
Set rg = wsheet.Range(Cells(1, 2), Cells(8, 2))
rg.Select
pt(0) = 0: pt(1) = 0: pt(2) = 0
For Each cll In rg
ThisDrawing.ModelSpace.AddText cll.Value, pt, 0.16
pt(0) = pt(0) + 1
pt(1) = pt(1) + 1
Next cll
End If
If Not exapp Is Nothing Then
exapp.Quit
End If
ThisDrawing.Regen (acActiveViewport)
End Sub{code}
Edited by: HJohn1 on Mar 4, 2009 10:57 PM
Edited by: HJohn1 on Mar 5, 2009 1:47 AM