Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Excel 2003 - Color codes

Hello,

I was using the colorindex of the palette in my vba code (2003) but it's not
convenient because it gives different colors when the vba code is used on
excel workbooks with a different palette

I though i would get the same color whatever the palette by using RGB codes
instead but i have the same problem : For example, RGB (204, 255, 204) gives
different colors in different workbooks

How can i get always the same colors?

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Excel 2003 - Color codes

The only way would be to configure the colours of every workbook as it was
opened. Excel will map any colour that you define to the closest match on
the standard color palette and use that colorindex.

--
__________________________________
HTH

Bob

"thomas" <nomail wrote in message
...
Hello,

I was using the colorindex of the palette in my vba code (2003) but it's
not
convenient because it gives different colors when the vba code is used on
excel workbooks with a different palette

I though i would get the same color whatever the palette by using RGB
codes
instead but i have the same problem : For example, RGB (204, 255, 204)
gives
different colors in different workbooks

How can i get always the same colors?

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Excel 2003 - Color codes

The palette only contains 56 colours, in a default palette there are 10
duplicates. If you attempt to apply your own RGB Excel will match it to the
closest it can find in the palette.

Your particular RGB example does exist in a default palette, so if index 35
has not been customized you will get a perfect match.

If you want to be sure your colour is applied, but only customize a palette
colour if necessary you could do something like this

colVal = RGB(234, 255, 234) ' very pale green
With Range("a1").Interior
.Color = colVal
If .Color < colVal Then
' the RGB doesn't exist
ActiveWorkbook.Colors(25) = colVal
.ColorIndex = 25
End If
End With


Of course you'd need to be sure you are not messing with someones carefully
customized colour.

Regards,
Peter T


"thomas" <nomail wrote in message
...
Hello,

I was using the colorindex of the palette in my vba code (2003) but it's
not
convenient because it gives different colors when the vba code is used on
excel workbooks with a different palette

I though i would get the same color whatever the palette by using RGB
codes
instead but i have the same problem : For example, RGB (204, 255, 204)
gives
different colors in different workbooks

How can i get always the same colors?

Thanks



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Re : Excel 2003 - Color codes

Many thanks

I now better understand



"Peter T" <peter_t@discussions a écrit dans le message de groupe de
discussion : ...
The palette only contains 56 colours, in a default palette there are 10
duplicates. If you attempt to apply your own RGB Excel will match it to the
closest it can find in the palette.

Your particular RGB example does exist in a default palette, so if index 35
has not been customized you will get a perfect match.

If you want to be sure your colour is applied, but only customize a palette
colour if necessary you could do something like this

colVal = RGB(234, 255, 234) ' very pale green
With Range("a1").Interior
.Color = colVal
If .Color < colVal Then
' the RGB doesn't exist
ActiveWorkbook.Colors(25) = colVal
.ColorIndex = 25
End If
End With


Of course you'd need to be sure you are not messing with someones carefully
customized colour.

Regards,
Peter T


"thomas" <nomail wrote in message
...
Hello,

I was using the colorindex of the palette in my vba code (2003) but it's
not
convenient because it gives different colors when the vba code is used on
excel workbooks with a different palette

I though i would get the same color whatever the palette by using RGB
codes
instead but i have the same problem : For example, RGB (204, 255, 204)
gives
different colors in different workbooks

How can i get always the same colors?

Thanks


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Re : Excel 2003 - Color codes

so it's useless to use RGB codes. better keeping using colorindex ?


"thomas" <nomail a écrit dans le message de groupe de discussion :
...
Many thanks

I now better understand



"Peter T" <peter_t@discussions a écrit dans le message de groupe de
discussion :
...
The palette only contains 56 colours, in a default palette there are 10
duplicates. If you attempt to apply your own RGB Excel will match it to the
closest it can find in the palette.

Your particular RGB example does exist in a default palette, so if index 35
has not been customized you will get a perfect match.

If you want to be sure your colour is applied, but only customize a palette
colour if necessary you could do something like this

colVal = RGB(234, 255, 234) ' very pale green
With Range("a1").Interior
.Color = colVal
If .Color < colVal Then
' the RGB doesn't exist
ActiveWorkbook.Colors(25) = colVal
.ColorIndex = 25
End If
End With


Of course you'd need to be sure you are not messing with someones carefully
customized colour.

Regards,
Peter T


"thomas" <nomail wrote in message
...
Hello,

I was using the colorindex of the palette in my vba code (2003) but it's
not
convenient because it gives different colors when the vba code is used on
excel workbooks with a different palette

I though i would get the same color whatever the palette by using RGB
codes
instead but i have the same problem : For example, RGB (204, 255, 204)
gives
different colors in different workbooks

How can i get always the same colors?

Thanks




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Excel 2003 - Color codes

Not necessarily "useless to use RGB codes" at all, depends on the overall
scenario. Sometimes RGB values are exactly what you do want to use.

Regards,
Peter T

"thomas" <nomail wrote in message
...
so it's useless to use RGB codes. better keeping using colorindex ?


"thomas" <nomail a écrit dans le message de groupe de discussion :
...
Many thanks

I now better understand



"Peter T" <peter_t@discussions a écrit dans le message de groupe de
discussion :
...
The palette only contains 56 colours, in a default palette there are 10
duplicates. If you attempt to apply your own RGB Excel will match it to
the
closest it can find in the palette.

Your particular RGB example does exist in a default palette, so if index
35
has not been customized you will get a perfect match.

If you want to be sure your colour is applied, but only customize a
palette
colour if necessary you could do something like this

colVal = RGB(234, 255, 234) ' very pale green
With Range("a1").Interior
.Color = colVal
If .Color < colVal Then
' the RGB doesn't exist
ActiveWorkbook.Colors(25) = colVal
.ColorIndex = 25
End If
End With


Of course you'd need to be sure you are not messing with someones
carefully
customized colour.

Regards,
Peter T


"thomas" <nomail wrote in message
...
Hello,

I was using the colorindex of the palette in my vba code (2003) but it's
not
convenient because it gives different colors when the vba code is used on
excel workbooks with a different palette

I though i would get the same color whatever the palette by using RGB
codes
instead but i have the same problem : For example, RGB (204, 255, 204)
gives
different colors in different workbooks

How can i get always the same colors?

Thanks




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
Entering ASCII codes with Excel 2003 phuycke Excel Discussion (Misc queries) 2 January 1st 10 06:43 PM
Excel 2003 list of field codes for footers? SS.Minnowski Excel Discussion (Misc queries) 4 April 21st 06 05:13 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
Using excel 2003 cannot see Canadian Postal Codes PW Excel Worksheet Functions 0 November 8th 05 07:21 PM
Excel 2003 will not display color fonts or color fill cells DaveC Excel Worksheet Functions 1 April 11th 05 04:38 PM


All times are GMT +1. The time now is 08:52 PM.

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

About Us

"It's about Microsoft Excel"