Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Setting Colors Using Other Than ColorIndex?

I'm in MS Access VBA and want to format a totals break line

e.g.
-----------------------------------------------------------------------------------------
18140 With .Range(.Cells(theBreakRowNum, mColNum_FirstData), .Cells
(theBreakRowNum, mColNum_LastData))
18141 .Interior.ColorIndex = theBackColor
18142 .Borders(xlEdgeTop).Weight = xlMedium
18143 .Borders(xlEdgeBottom).Weight = xlMedium
18149 End With
-----------------------------------------------------------------------------------------

Right now, I'm passing an Excel "Color Index" like 10 for bright red
or 15 for light grey.

But now I'd like to add a color picker so the user can specify which
colors to use for which totals.

Problem is that my implementation of said color picker returns numbers
like 255 for bright red or 16119285 for light grey.

Question: Is there some other property I can set
besides .Interior.ColorIndex that will accept those color numbers and
render accordingly?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Setting Colors Using Other Than ColorIndex?

use .Interior.Color

sample

Option Explicit
Enum eCOls
LightGrey = 16119285
BrightRed = 16119285
End Enum
Sub test()
With .Range(.Cells(theBreakRowNum, mColNum_FirstData),
..Cells(theBreakRowNum, mColNum_LastData))
.Interior.Color = eCOls.LightGrey
.Borders(xlEdgeTop).Weight = xlMedium
.Borders(xlEdgeBottom).Weight = xlMedium
End With

End Sub

"PeteCresswell" wrote in message
...
I'm in MS Access VBA and want to format a totals break line

e.g.
-----------------------------------------------------------------------------------------
18140 With .Range(.Cells(theBreakRowNum, mColNum_FirstData), .Cells
(theBreakRowNum, mColNum_LastData))
18141 .Interior.ColorIndex = theBackColor
18142 .Borders(xlEdgeTop).Weight = xlMedium
18143 .Borders(xlEdgeBottom).Weight = xlMedium
18149 End With
-----------------------------------------------------------------------------------------

Right now, I'm passing an Excel "Color Index" like 10 for bright red
or 15 for light grey.

But now I'd like to add a color picker so the user can specify which
colors to use for which totals.

Problem is that my implementation of said color picker returns numbers
like 255 for bright red or 16119285 for light grey.

Question: Is there some other property I can set
besides .Interior.ColorIndex that will accept those color numbers and
render accordingly?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 139
Default Setting Colors Using Other Than ColorIndex?

Per Patrick Molloy:
use .Interior.Color

sample

Option Explicit
Enum eCOls
LightGrey = 16119285
BrightRed = 1611928


Thanks.... Also for the "Enum" syntax.

I never got into using Enums - using constants like
"gExcelColor_Blue", "gExcelColor_Red"....

An Enum for "ExcelColor" makes a lot more sense and, I'm
assuming, brings AutoCompletion into the picture.
--
PeteCresswell
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
need codeto view the 56 colors of ColorIndex SuitedAces[_14_] Excel Programming 2 June 30th 06 07:26 AM
VBA Error setting Font.ColorIndex Steve Barnett Excel Programming 4 June 24th 05 11:00 AM
What are the values for ColorIndex 's 56 colors ? i.e. green=3 . RandyDtg1[_2_] Excel Programming 9 April 13th 05 08:08 PM
WHere can I find a list of ColorIndex colors? Christiane[_12_] Excel Programming 3 April 28th 04 04:12 PM
EXCEL VB Macro Run Time Error 1004 - Setting ColorIndex Erwin[_2_] Excel Programming 4 April 14th 04 03:52 PM


All times are GMT +1. The time now is 02:34 PM.

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"