Hey, i think got some code for this situation too.
...Hold on, ill go try to find it. ...Found it!
;;;===================================================================;
;;; Get-EntSelected ;
;;;-------------------------------------------------------------------;
;;; This procedure will offer a way for the programer to get an ;
;;; entity or entities already slected on the screen before the ;
;;; program took control. This program was intended for use in an ;
;;; ActiveX program. I have chosen not to use the "Pickfirst" method ;
;;; in accomplishing this task because I wanted a way to do this even ;
;;; if the "pickfirst" variable was toggled to zero. If no entity is ;
;;; currently selected on the screen, this function will prompt the ;
;;; end user to select an entity. ;
;;; ;
;;; Author: John Kaul ;
;;; ;
;;; Returns: Either previously selected entity, a selected entity, or ;
;;; a list of selected entities. ;
;;; ;
;;; Usage: (vlax-ename->vla-object (Get-EntSelcted)) ;
;;; ;
;;;-------------------------------------------------------------------;
;;; Version: 1.1 Added the ability to have more then one selected ;
;;; objects on the screen. ;
;;;===================================================================;
(defun Get-EntSelected (/ x cntr xlength xlist)
(setq x (cadr (ssgetfirst)))
(if x (setq xlength (sslength x)))
(cond
((= xlength 1)
(setq x (ssname x 0))
(sssetfirst nil)
(redraw x 3))
((> xlength 1)
(setq cntr xlength)
(cond
((>= cntr 2)
(setq cntr (1- xlength))
(while (>= cntr 0)
(setq xlist (cons (ssname x cntr) xlist)
cntr (1- cntr)))
(foreach a xlist (progn (sssetfirst nil) (redraw a 3))))))
;; Might not want to have this function do any selecting for you.
;; if you do, un-comment this block.
;;; ((= xlength nil)
;;; (while (not (setq x (entsel "\nselect object: "))))
;;; (setq x (car x))
;;; (sssetfirst nil)
;;; (redraw x 3))
)
(if (= nil xlist) x xlist)
)
How's that?