Hi @BIGAL, thank you for your CODE, I have not so familiarity with lisp language, as I have with VBA, however the scope of code was to give a path, a way to follow, some suggestions to AMIR, I don't know exactly what needs he want to do. Once he had a starting code of course he can expand the procedure functionality writing some other code.
Initially he asked "....Hi all guys, I'm recently started vba autocad, for my first program I'm going to create a selection set of texts and sort the texts by y coordinate, but I couldn't find a way to sort them by Y coordinate :..." , seems he received more help than he required:
He has a code to retrive object coordinates, first step in order to get the object coordinates and later sort by Y coordinate.
He has a code to sort the selected text by Y coordinate and redraw the same on drawing
He has a code for exporting selected text on drawing into a text file readable by a notepad
He has a code for exporting in Excel selected text, relative coordinates, and some other object information.
I guess he has now more opportunities to manage own drawing automation compared with starting request.
Thank you again, bye.