Thanks kpblc for your replay .
I changed the command code about "chprop" with the following code and got rid of the error !
(if (!= (setq A (ssget)
nil
)
)
(repeat (setq i (sslength A))
(setq sn (ssname A (setq i (1- i))))
(setq obj (vlax-ename->vla-object sn))
(setq check (vlax-property-available-p obj "LineType" T))
(if check
(progn
(vlax-put-property obj 'linetype (getvar "celtype"))
(princ "\n")
(vla-regen
(vla-get-activedocument
(vlax-get-acad-object)
)
acactiveviewport
)
)
)
)
)
If someone has a better way, please advise me .