TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Amsterdammed on March 25, 2013, 10:32:40 AM
-
Hello there,
I'm still in the excel problems, i would like to change the background of a cell, like in VBA
Range("A1:A6").Interior.Color = RGB(200,160,35)
is thee a similar thing in vlisp?
Thanks,
Bernd
-
Try it
(vl-load-com)
(setq OEX (vlax-get-or-create-object "Excel.Application")) ;_Object Excell
(setq OWRB (vlax-get-property OEX 'Workbooks)) ;_Object Workbook
(setq AWB (vlax-invoke-method OWRB 'Add)) ;_Active Workbook
(setq ASH (vlax-get-property AWB "Worksheets")) ;_Active WorkSheet
(setq MySheet (vlax-invoke-method ASH 'Add)) ;_Sheet
(vlax-put-property OEX "Visible" :vlax-true)
(setq cell (vlax-variant-value ;_Range
(vlax-invoke-method
MySheet
"Evaluate"
"A1:A6"
) ;_ end of vlax-invoke-method
) ;_ end of vlax-variant-value
) ;_ end of setq
(setq obj (vlax-get-property cell 'Interior)) ;_Interior
(vlax-put-property obj 'Colorindex 6) ;_Color
(vlax-release-object obj)
(vlax-release-object cell)
(vlax-release-object MySheet)
(vlax-release-object ASH)
(vlax-release-object AWB)
(vlax-release-object OWRB)
(vlax-release-object OEX)
-
Perfect!!!!:-D
Thanks,
Bernd