Excel Quit: new behaviour - Excel: multi range - Excel quit
--
________________________________________________
Marc'Antonio Alessi (TV) Italy
(strcat "NOT a " (substr (ver) 8 4) " guru.")
O.S. = XP Pro 2002 - Sp.1 - Ita
AutoCAD = 2002 Ita - Sp.1
_VERNUM = "K.0.44"
ACADVER = "15.06s (LMS Tech)"
(ver) = "Visual LISP 2000 (it)"
________________________________________________
(setq mmls '((5.5 4 33 "O")(nil 6.6 44 "K")(7 nil 7.7 "MM")))
(xlp-put-value (xlp-get-range xlas "A1:D3")
(vlax-safearray-fill
(vlax-make-safearray vlax-vbVariant (cons 0 (1- (length mmls)))
(cons 0 (1- (length (car mmls)))))
(mapcar '(lambda (itm) (mapcar 'vlax-make-variant itm)) mmls)))
HTH
"PeterSCiganek" <peter....@schuster-pechtold.de> wrote in message
news:f17ff...@WebX.maYIadrTaRb...
> I am trying to pass a single dimension safe-array to a range in Excel. For some reason - the range
only accepts the first atom of the array. This is how the code excecutes:
> (setq range_object (vlax-get-property worksheet_object 'Range "A1:A6"))
>
> (vlax-put-property range_object 'Value2 safe_array)
>
> The safe array is correctly typed and does contain separate values.
>
> I am currently passing each value individually to a cell - and am hoping to speed up the transfer
of data by passing arrays. What am I doing wrong?
>
> Thanks for any help,
>
> Peter
>
>
and
Search: Visual LISP ActiveX API for Excel - reposted
on autodesk.autocad.customer-files 2003-05-22
HTH
Marco
;
; ALEax_Make2DimSafeArray (original by Mark)
; Argument: a list
; Examples:
; (ALEax_Make2DimSafeArray '((5.5 4 33 "O")(nil 6.6 44 "K")(7 nil 7.7
"MM")))
;
(defun ALEax_Make2DimSafeArray (ImpLst)
(vlax-safearray-fill
(vlax-make-safearray vlax-vbVariant
(cons 0 (1- (length ImpLst))) (cons 0 (1- (length (car ImpLst))))
)
(mapcar '(lambda (x) (mapcar 'vlax-make-variant x)) ImpLst)
)
)
(defun C:XlNew ( )
(vl-load-com)
(setq
*ExcelApp* (vlax-get-or-create-object "Excel.Application")
*ActiveWbk*
(vlax-invoke-method
(vlax-get-property *ExcelApp* 'WorkBooks) 'Add
)
*ActiveSht* (vlax-get-property *ExcelApp* 'ActiveSheet)
*ActiveCls* (vlax-get-property *ActiveSht* 'Cells)
)
(vla-put-visible *ExcelApp* 1)
(setq
RngObj
(vlax-get-property
*ActiveSht* 'Range
"A1:D3"
)
)
(vlax-put-property RngObj 'Value2
(ALEax_Make2DimSafeArray
'((5.5 4 33 "O")(nil 6.6 44 "K")(7 nil 7.7 "MM"))
)
)
)
(defun C:XlClose ( )
(vlax-release-object RngObj) ;<<
(vlax-release-object *ActiveCls*)
(vlax-release-object *ActiveSht*)
(vlax-invoke-method *ActiveWbk* 'Close 0)
(vlax-release-object *ActiveWbk*)
(vlax-invoke-method *ExcelApp* 'QUIT)
(vlax-release-object *ExcelApp*)
(setq
*ExcelApp* nil *ActiveWbk* nil *ActiveSht* nil *ActiveCls* nil
RngObj nil
)
(gc)
)
any luck on the nested rectangles...
very much interested to know what
algorithm others are using.
Mark
BTW
Peter also should know that
the list and the range string should
be in sync, othewise the result will
be incorrect, i.e.
"A1:D3" and
'((A1 B1 C1 D1)(A2 B2 C2 D2)(A3 B3 C3 D3))
or
"A1:A5" and
'((A1)( A2 )(A3)( A4 )(A5))
"Marc'Antonio Alessi" <maalessi at tin dot it> wrote in message
news:CE1ACFD7B660AE93...@in.WebX.maYIadrTaRb...
no news, I have given a glance to
www.techno-sys.com www.nirvanatec.com
but I have not tried any more.
Cheers.
Marco