Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default set color (vc++)


Hi,
I have to write an application in vc++ which will be processing exce
files. I already know how to put something in specific cell but I hav
no idea how to change a color of the cell. Do you know how to do this
Thanks for any tips and advices. Below I paste piece of code which
use to put somthing in the cell A1.

_Application objApp;
_Workbook objBook;
Workbooks objBooks;
Worksheets objSheets;
_Worksheet objSheet;
Range range;
COleVariant VOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);

objBooks = objApp.GetWorkbooks();
objBook = objBooks.Add(VOptional);
objSheets = objBook.GetWorksheets();
objSheet = objSheets.GetItem(COleVariant((short)1));

range = objSheet.GetRange(COleVariant("A1"),COleVariant("A 1"));
range.SetValue(COleVariant("aaa"))

--
vavshe
-----------------------------------------------------------------------
vavshek's Profile: http://www.excelforum.com/member.php...fo&userid=1651
View this thread: http://www.excelforum.com/showthread.php?threadid=31372

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default set color (vc++)

Don't know vc++, but to set a colour, use

range.Interior.Colorindex=35

the number is the colour pallette index number.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"vavshek" wrote in message
...

Hi,
I have to write an application in vc++ which will be processing excel
files. I already know how to put something in specific cell but I have
no idea how to change a color of the cell. Do you know how to do this?
Thanks for any tips and advices. Below I paste piece of code which I
use to put somthing in the cell A1.

_Application objApp;
_Workbook objBook;
Workbooks objBooks;
Worksheets objSheets;
_Worksheet objSheet;
Range range;
COleVariant VOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);

objBooks = objApp.GetWorkbooks();
objBook = objBooks.Add(VOptional);
objSheets = objBook.GetWorksheets();
objSheet = objSheets.GetItem(COleVariant((short)1));

range = objSheet.GetRange(COleVariant("A1"),COleVariant("A 1"));
range.SetValue(COleVariant("aaa"));


--
vavshek
------------------------------------------------------------------------
vavshek's Profile:

http://www.excelforum.com/member.php...o&userid=16518
View this thread: http://www.excelforum.com/showthread...hreadid=313721



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Powerpoint / Excel: custom pp RGB color doesn't match identical Excelcustom RGB color mikewillnot Charts and Charting in Excel 1 February 26th 08 05:22 PM
Can't format cell color/text color in Office Excel 2003 in fil Tony S Excel Discussion (Misc queries) 1 December 21st 07 01:41 PM
Can't format cell color/text color in Office Excel 2003 in files . albertaman Excel Discussion (Misc queries) 0 February 16th 06 03:56 AM
My fill color and font color do not work in Excel Std Edition 2003 chapstick Excel Discussion (Misc queries) 1 September 11th 05 08:48 PM
My excel 2003 wont let me fill cells with color or color the tabs. trizog New Users to Excel 2 February 22nd 05 06:43 PM


All times are GMT +1. The time now is 08:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"