(Defun vlxls-app-open(XLSFile UnHide / ExcelApp WorkSheet Sheets ActiveSheet Rtn)
;;;function: this program can open an excelfile
(setq XLSFile (strcase XLSFile))
(if (null (wcmatch XLSFile "*.XLS"))
(setq XLSFile (strcat XLSFile ".XLS")))
(if (and (findfile XLSFile)
(setq Rtn (vlax-get-or-create-object "Excel.Application")))
(progn (vlax-invoke-method (vlax-get-property Rtn 'WorkBooks)
'Open XLSFile)
(if UnHide
(vla-put-visible Rtn 1)
(vla-put-visible Rtn 0))))
Rtn)
(setq *xlapp* (vlxls-app-open "C:/test.XLS"nil))
(SETQ AA(msxl-GET-value1
(msxl-get-range *XLAPP*"A1")
))
(vlax-variant-value AA)
(vlax-invoke-method *xlapp*'QUIT) 关闭程序
页:
1
[2]