How to Xport coord to excel (suite)

How to Xport coord to excel (suite)

Anonymous
Not applicable
250 Views
2 Replies
Message 1 of 3

How to Xport coord to excel (suite)

Anonymous
Not applicable
Hi,

I am quite new to VBA. Concerning the code to export that you showed:
What is the instruction/code line to add to it so that it continue to wait for user input until an event (like pushing ESC, right clicking, typing any key) occurs?


Thanks again
0 Likes
251 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Hi,

There are lots of sample code items for this in the help files.


--

Regards,


Laurie Comerford
www.cadapps.com.au

wrote in message news:5231137@discussion.autodesk.com...
Hi,

I am quite new to VBA. Concerning the code to export that you showed:
What is the instruction/code line to add to it so that it continue to wait
for user input until an event (like pushing ESC, right clicking, typing any
key) occurs?


Thanks again
0 Likes
Message 3 of 3

Anonymous
Not applicable
This will export text to excel from a aleady open excel session.

hope this helps
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

' 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"
intRow = 2

For Each obj In ThisDrawing.ModelSpace
If TypeOf obj Is AcadText Then
Set objText = obj
oExcel.Cells(intRow, 3).Value = objText.TextString
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














wrote in message news:5231137@discussion.autodesk.com...
Hi,

I am quite new to VBA. Concerning the code to export that you showed:
What is the instruction/code line to add to it so that it continue to wait
for user input until an event (like pushing ESC, right clicking, typing any
key) occurs?


Thanks again
0 Likes