Hello everyone... I'm trying to use this routine (defun C:BYLAYER ( / acad doc ssall i obj) (vl-load-com) (setq acad (vlax-get-acad-object) doc (vla-get-activedocument acad) ) (vla-startundomark acad) (vla-zoomextents acad) (cond ( (setq ssall (ssget "x")); get all entities (setq i 0) (repeat (sslength ssall) (setq obj (vlax-ename->vla-object (ssname ssall i))) (vlax-put-property obj "Color" acByLayer) (vlax-put-property obj "Linetype" "ByLayer") (vlax-put-property obj "Lineweight" acLnWtByLwDefault) (vlax-release-object obj) (setq i (1+ i)) ) ) ) (vla-endundomark acad) (princ " Finished processing all entities.") (princ) ) And I always get this message ; error: ActiveX Server returned the error: unknown name: ActiveDocument Why do I keep on receiving this message? Any ideas? Thanks to all future responses. Regards Henrique