Dwg to Excel

Dwg to Excel

Anonymous
Not applicable
389 Views
4 Replies
Message 1 of 5

Dwg to Excel

Anonymous
Not applicable
Hi All
I would like to know is there any code which can pull my drawing data(Only Text Data) which is in particular layer
Can I get into Excel Sheet
Thinking u
0 Likes
390 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Naresh,

There is a sample that comes
with AutoCAD. I think there
is one that pulls the data from
Excel. If not, this code has
been posted here, and in
the customization group
many times. Do a search
and let us know if your
having any problems finding
what you need. I'm bored today
if you cannot find I will write it
for you.

gl
Paul
wrote in message news:[email protected]...
Hi All
I would like to know is there any code which can pull my drawing data(Only
Text Data) which is in particular layer
Can I get into Excel Sheet
Thinking u
0 Likes
Message 3 of 5

Anonymous
Not applicable
Here is a sample that might get to going in the right direction

John Coon


Option Explicit

Public intRow As Integer
Public strCell As String

' Application - Excel
Public oExcel As Excel.Application
Public oBook As Excel.Workbook
Public oSheet As Excel.Worksheet


Private Sub CreateExcel()
Dim i As Integer
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Add
Set oSheet = oBook.Worksheets(1)

oExcel.Visible = True
End Sub

Public Sub TextToExcel()
Dim obj As AcadEntity
Dim objText As AcadText
Dim varInsert As Variant
Dim TEXTRot As String
' Create an Excel object


CreateExcel

oExcel.Cells(1, 1).Value = "X: COORDINATE"
oExcel.Cells(1, 2).Value = "Y: COORDINATE"
oExcel.Cells(1, 3).Value = "TEXT VALUE"
oExcel.Cells(1, 4).Value = "TEXT ROTATION"
intRow = 2

For Each obj In ThisDrawing.ModelSpace
If TypeOf obj Is AcadText Then
Set objText = obj
oExcel.Cells(intRow, 3).Value = objText.TextString
oExcel.Cells(intRow, 4).Value = objText.Rotation
varInsert = objText.InsertionPoint
oExcel.Cells(intRow, 1).Value = varInsert(0)
oExcel.Cells(intRow, 2).Value = varInsert(1)


intRow = intRow + 1
End If
Next obj
End Sub



























"Paul Richardson" wrote in message
news:[email protected]...
Naresh,

There is a sample that comes
with AutoCAD. I think there
is one that pulls the data from
Excel. If not, this code has
been posted here, and in
the customization group
many times. Do a search
and let us know if your
having any problems finding
what you need. I'm bored today
if you cannot find I will write it
for you.

gl
Paul
wrote in message news:[email protected]...
Hi All
I would like to know is there any code which can pull my drawing data(Only
Text Data) which is in particular layer
Can I get into Excel Sheet
Thinking u
0 Likes
Message 4 of 5

Anonymous
Not applicable
hey john thanks i am trying it tomorrow & i will be back to day after tomorrow
0 Likes
Message 5 of 5

Anonymous
Not applicable
Naresh,
Sorry clicked on wrong section.

Replaced this. You can arrange them in the order you need.

CreateExcel

oExcel.Cells(1, 1).Value = "X: COORDINATE"
oExcel.Cells(1, 2).Value = "Y: COORDINATE"
oExcel.Cells(1, 3).Value = "TEXT VALUE"
oExcel.Cells(1, 4).Value = "TEXT ROTATION"
oExcel.Cells(1, 5).Value = "LAYER"
intRow = 2

For Each obj In ThisDrawing.ModelSpace
If TypeOf obj Is AcadText Then
Set objText = obj
oExcel.Cells(intRow, 3).Value = objText.TextString
oExcel.Cells(intRow, 4).Value = objText.Rotation
oExcel.Cells(intRow, 5).Value = objText.Layer
varInsert = objText.InsertionPoint
oExcel.Cells(intRow, 1).Value = varInsert(0)
oExcel.Cells(intRow, 2).Value = varInsert(1)










wrote in message news:[email protected]...
hey john thanks i am trying it tomorrow & i will be back to day after
tomorrow
0 Likes