Old post, but always a good idea to review the Microsoft Office/Excel API reference for details on methods and properties when trying to do this kind of thing
https://docs.microsoft.com/en-us/office/vba/api/excel.workbooks.open
try this;
(alert "ONLY WORKS ON MTEXT
Command:ASD
SMART LEADER
")
(setq osm (getvar 'osmode))
(defun c:asd ()
(command "ucs" "w") ;return to ucs
(setvar 'osmode 0)
(setq a (car (entsel)) ;select of text
b (entget a) ;convert to list
c (vlax-ename->vla-object a) ;convert ot vla?
d (cdr (assoc 10 b)) ;get origin point
e 140 ;text offset
f 1000 ;scale
g (vlax-get-property c 'width) ;width of text
h (list 0.0 (* -1 e) 0.0) ;leader alignment left
i (list g (* -1 e) 0.0) ;leader alignment right
)
(command "ucs" "object" a) ;ucs of object
(command "xline" h i "") ;xline for reference
(setq xl-del (entlast)) ;for deletion of xline
(setq j (getpoint h)) ;point where leader will be
(if (< (distance j h) (distance j i)) ;detecting which side
(setq k j l h m i) ;setting up points
(setq k j l i m h)) ;setting up points
(command "leader" k l m "" "" "n") ;leader
(command "erase" xl-del "") ;delete xline
(setvar 'osmode osm)
(command "ucs" "w") ;return to ucs
)