VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Text Selection

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
186 Views, 2 Replies

Text Selection

How can I get the text string of all text in a drawing with a height of .21875 that is one character in length using VBA and no manual selection?

Thanks
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

See if the sample below does what you want.

Gary

Dim iDxfCode(2) As Integer
Dim vDxfData(2) As Variant
Dim oTextEnt As AcadText

iDxfCode(0) = 0
vDxfData(0) = "TEXT"

iDxfCode(1) = 40
vDxfData(1) = 0.21875

iDxfCode(2) = 1
vDxfData(2) = "?"

Dim oTextSet As AcadSelectionSet

On Error Resume Next
Set oTextSet = ThisDrawing.SelectionSets("TextSet")
If Err Then
Err.Clear
Set oTextSet = ThisDrawing.SelectionSets.Add("TextSet")
End If
On Error GoTo 0

oTextSet.Select acSelectionSetAll, , , iDxfCode, vDxfData

oTextSet.Highlight True

For Each oTextEnt In oTextSet
Debug.Print oTextEnt.TextString
Next

oTextSet.Clear
Message 3 of 3
Anonymous
in reply to: Anonymous

Perfect, and Thank You!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost