Hi @yasminezahir20 just for example:
Sub Testi()
Dim oApp_Excel As Excel.Application
Dim oBook As Excel.workbook
Dim MyObject As AcadEntity
Set oApp_Excel = CreateObject("EXCEL.APPLICATION")
Set oBook = oApp_Excel.workbooks.Add
oApp_Excel.Visible = True
oApp_Excel.workbooks(oApp_Excel.ActiveWorkbook.Name).Activate
Row = 2
For Each MyObject In ThisDrawing.ModelSpace
If TypeOf MyObject Is AcadText Or TypeOf MyObject Is AcadMText Then
If Right(MyObject.TextString, 2) <> "kW" Then 'Filter on partial text contents
If Len(MyObject.TextString) > 1 Then 'filter on text with lenght higher than 1 char
oApp_Excel.Sheets(ActiveSheet.Name).Range("A" & Row).Value = MyObject.TextString
Row = Row + 1
End If
End If
End If
Next
End Sub
Please note that the above code extract all text, and Mtext including special format code of Mtext.
You should add to the project libray MS office Excel lib.
If you want to remove special code formatting from Mtext, search on this forum, there is a function for removing special char code.