Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Talking to Excel from BricsCAD v14 using VBA

Having spent a week in a failed attempt to get Excel to talk reliably with BricsCAD, I am now considering approaching it the other direction. I.e. Accessing information in an Excel spreadsheet, from VBA embedded in an AutoCAD drawing.

The reason I am posting, is in hopes that someone can confirm for me that this is likely to work reliably. I would rather not spend another 1 1/2 weeks going down a bad road.

I found one example for AutoCAD, and found that it does work.

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 ("d:\Temp\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

End If

ThisDrawing.Regen (acActiveViewport)

End Sub

Can anyone say this approach will be reliable?

[Note that when I preview some lines of text get very large. I don't know why, but the forum has been doing some random formatting on its own.]

-Joe

This discussion has been closed.
Origami
Origami is the Japanese word for paper folding. ORI means to fold and KAMI means paper and involves the creation of paper forms usually entirely by folding.

Powered by VanillaForums, Designed by Steam