LTiger86 发表于 2014-3-13 15:55:56

导入EXCEL数据问题~求帮忙

(defun GetCellValueAsList(excelFile sheetName RangeStr / xl wbs wb shs sh rg cs vvv nms nm ttt)
(vl-load-com)
(setq xl (vlax-get-or-create-object "Excel.Application"))
(setq wbs (vlax-get-property xl "WorkBooks"))
(setq wb (vlax-invoke-method wbs "open" excelFile))
(setq shs (vlax-get-property wb "Sheets"))
(setq sh (vlax-get-property shs "Item" sheetName))
(setq rg (vlax-get-property sh "Range" RangeStr))
(setq vvv (vlax-get-property rg 'Value))
(setq ttt (vlax-safearray->list (vlax-variant-value vvv)))
(vlax-invoke-method wb "Close" )
(vlax-invoke-method xl "Quit")
(vlax-release-object xl)
(setq ret ttt)
)
(defun getb()
(setq retV (GetCellValueAsList "C:\\aa2.xlsx" "Sheet1" "A3:E3"))
(princ)
)
最后怎么把retV的数据导入到list里?
如果用vlax-variant-value 代码该怎么写

77077 发表于 2014-3-13 17:53:43

cons list append
随便你用,我胡说的,呵呵~~~
页: [1]
查看完整版本: 导入EXCEL数据问题~求帮忙