Hello Everyone.
Please check this code there seems to be a probelm everytime i select text or Mtext it will only generate
one iteration. What i want it for it to go through texts of any kind. and dump for me on Excel sheet.
here is some line of code i have gone so far. I have attached the drawing and Excel Macro code.
I want help for this to work.
Thank you.
Code:
Sub get_staiton()
Dim objDrawingObject As AcadText
Dim objDrawingObj As AcadMtext
Dim objSS As AcadSelectionSet
' i created here a random characters to add as a selection set name
Range("b1").Formula = "=CHAR(RANDBETWEEN(67,90))&CHAR(RANDBETWEEN(67,90))&CHAR(RANDBETWEEN(67,90))&CHAR(RANDBETWEEN(67,90))&CHAR(RANDBETWEEN(67,90))&CHAR(RANDBETWEEN(67,90))&CHAR(RANDBETWEEN(67,90))&CHAR(RANDBETWEEN(67,90))"
yu = Range("b1").Value
Range("c1").Value = yu
With ActiveDocument.Utility
'' create a new selectionset
Set objSS = ActiveDocument.SelectionSets.Add(yu)
'' let user select entities interactively
objSS.SelectOnScreen
.Prompt vbCr & objSS.Count & " entities selected"
End With
' iterate selection...
n = 1
On Error Resume Next
For Each objDrawingObj In objSS
y = objDrawingObj.TextString
Cells(4 + n, 1) = y
n = n + 1
Next
n = 1
For Each objDrawingObject In objSS
y = objDrawingObject.TextString
Cells(4 + n, 1) = y
n = n + 1
Next
End Sub