TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Lee Mac on August 20, 2009, 08:34:36 AM
-
I have been trying to work with Excel using Visual LISP, but my attempts have been pretty poor so far...
I cannot seem to get the "Item" method to work at all - I am trying to activate a specific Worksheet within a specific Workbook, (without the need to cycle through all the objects in a collection).
I have tried something like this, but keep getting "Error: Member not Found.":
(setq xlApp (vlax-get-or-create-object "Excel.Application"))
(setq Sht (vlax-invoke
(vlax-get-property
(vlax-invoke
(vlax-get-property xlApp 'Workbooks)
"Add")
'Sheets)
'Item "Sheet1"))
Any help is appreciated.
-
Took a bit thrashing, but got it figured out.
(defun c:abc (/)
(setq xlApp (vlax-get-or-create-object "Excel.Application"))
(setq xlWbks (vlax-get-property xlApp 'WorkBooks))
(setq xlShts (vlax-get-property (vlax-invoke xlWbks "Add") 'Sheets))
(setq xlItem (vlax-get-property xlShts "Item" "Sheet1"))
)
-
Thanks Paul,
Ahh, so Item is a property... not a method :ugly:
Cheers,
Lee