关于vlax-get-property函数参数的问题
[*]想把这句:ActiveSheet.Range("A65535").End(xlUp).Row
[*]改为vlisp应该怎么写?下面这句提示出错,不知道正确写法应该是怎么样写,求大神指点。
[*](vlax-get-property (vlax-get-property (vlax-get-property active-sheet "Range""A65535") "End" "xlUp") "Row")
http://bbs.mjtd.com/thread-181192-1-1.html
http://bbs.mjtd.com/forum.php?mod=viewthread&tid=180165&highlight=excel
;;;;;3、读取单元格数据,支持区域输入,sheet-工作表对象,rangeid-单元格地址如"A1"、"A2:B5"、"A1:A100"
(defun ljx-vlxls-get-range-value1 ( sheet rangeid / range value valuelist )
(setq range (vlax-get-property sheet 'Range rangeid))
(setq value (vlax-get-property range 'Value2))
(cond
((= (vlax-variant-type value)8204);;;为数组时,即为区域;
(setq value (vlax-safearray->list(vlax-variant-value value))
valuelist (mapcar '(lambda (x)(mapcar 'vlax-variant-value x)) value)
)
)
( T;;;;为单个单元格;
(setq valuelist (vlax-variant-value value))
)
);;;;cond
valuelist
)
;;;;运行示例函数
(defun test1 ()
(vl-load-com)
(setq exname "d:\\ABC.xls")
(setq *excel* vlax-get-or-create-object "excel.application"))
(setq *xlapp* (vlax-invoke-method (vlax-get-property *excel* 'Workbooks) 'Open exname))
(vla-put-visible *excel* 1)
(setq *sheet* (vlax-get-property (vlax-get-property *xlapp* 'Worksheets) 'item "DEF"))
(setq dat0 (Ljx-vlxls-get-range-value1 *sheet* "E5")
dat1 (Ljx-vlxls-get-range-value1 *sheet* "E5:F5");;;;输出:((-25.10 "张三"))
dat2 (Ljx-vlxls-get-range-value1 *sheet* "E5:E6");;;;输出:((-25.10)(26.85))
dat3 (Ljx-vlxls-get-range-value1 *sheet* "E5:F6");;;;输出:((-25.10 "张三")(26.85 "李四"))
dat4 (Ljx-read-excel-data1"E" 5 *sheet*);;;;-->-25.10
dat5 (Ljx-read-excel-text1"E"5*sheet* );;;;-->"-25.10"
dat6 (Ljx-read-excel-data1"E"6 *sheet* );;;;-->26.85
dat7 (Ljx-read-excel-text1 "E"6 *sheet*);;;;-->"26.85"
dat8 (Ljx-read-excel-data1 "F"5 *sheet*);;;;-->“张三”
dat9 (Ljx-read-excel-text1 "F"5 *sheet*);;;;-->“张三”
dat10 (Ljx-read-excel-data1"F"6 *sheet* );;;;-->"李四"
dat11 (Ljx-read-excel-text1"F"6 *sheet* );;;;-->"李四"
)
(vlax-invoke-method (vlax-get-property *excel* "ActiveWorkbook") 'Close 0)
(vlax-invoke-method *excel* 'QUIT)
(vlax-release-object *sheet*)
(vlax-release-object *xlapp*)
)
页:
[1]