Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Excel 2007, ThemeColor Light and Dark reversed

In Excel 2007, if I do:

Selection.Interior.ThemeColor = xlThemeColorLight1
Selection.Font.ThemeColor = xlThemeColorDark1

then I'd expect to see dark (black) text on a light (white) background, but
I'm actually getting the opposite - light text on a dark background. It's
also wrong if I try it the other way around and xlThemeColorDark2 and
xlThemeColorLight2 seem to be reversed in the same way, too. (And, no, I
haven't changed the theme colours from default).

Am I missing something completely obvious? I can't work out how this can be
expected behaviour. I'd be grateful if anyone could enlighten me.

Thanks
Chris
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 118
Default Excel 2007, ThemeColor Light and Dark reversed

Hello Chris,

From your post, my understanding on this issue is: you want to know why the
Selection's background color turns black and foreground is white when
Selection.Interior.ThemeColor is set to be xlThemeColorLight1 and
Selection.Font.ThemeColor = xlThemeColorDark1, and you wonder how to
reverse the colors. If I'm off base, please feel free to let me know.

According to the MSDN article:
http://msdn2.microsoft.com/en-us/library/Bb216356.aspx, the xlThemeColor
enumeration 'xlThemeColorLight1' is mapped to value 2, and
'xlThemeColorDark1' stands for value 1 by default.

The ThemeColor property uses the color table below, in which '1' means
White and '2' means Black.
'White = 1
'Black = 2
'Gray = 3
'Dark Blue = 4
'Light Blue = 5
'Maroon = 6
'Olive = 7
'Light Purple = 8
'Teal = 9
'Orange = 10
'Navy Blue = 11
'Dark Purple = 12

Therefore, to make the background color White and the foreground color
Black, please try the following VBA codes:
Selection.Interior.ThemeColor = xlThemeColorDark1 ' or 1
Selection.Font.ThemeColor = xlThemeColorLight1 ' or 2

Another approach is to use ColorIndex property instead of ThemeColor. In
ColorIndex's color table (http://support.microsoft.com/kb/192906) , '2' is
for White and '1' for Black.
Selection.Interior.ColorIndex = 2 ' White
Selection.Font.ColorIndex = 1 ' Black

If it still does not work, I wonder whether you have ever changed the color
palette for this workbook? (http://support.microsoft.com/kb/288412). The
change of the default palette will influence the corresponding color of
ColorIndex.

Please let me know if you have any other concerns, or need anything else.

Sincerely,
Jialiang Ge , remove 'online.')
Microsoft Online Community Support

==================================================
For MSDN subscribers whose posts are left unanswered, please check this
document: http://blogs.msdn.com/msdnts/pages/postingAlias.aspx

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express/Windows Mail, please make sure
you clear the check box "Tools/Options/Read: Get 300 headers at a time" to
see your reply promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Excel 2007, ThemeColor Light and Dark reversed

Thank you for re-summarizing the issue and confirming that Microsoft have
defined Light=Black and Dark=White.

However, if you inspect
ActiveWorkbook.Theme.ThemeColorScheme.Colors(msoTh emeDark1).RGB then you see
it is defined as black as expected. Granted, this method is using a different
enumeration to XlThemeColor, but there does seem to be a one-to-one mapping
with msoThemeDark1 = xlThemeColorDark1 = 1 (similarly for the other
enumeration constants).

My question is not how to reverse the colours in a specific instance - I
somehow managed to work that out on my own.

I would like to know the explanation behind this counter-intuitive
behaviour. If there is a good reason for it then I can continue to write
backwards code with some semblance of confidence. If, however, it is
considered a bug, then I would like to know that when it is fixed it will be
done in such a way as that it won't break any of the code I have written.

Thanks
Chris
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 118
Default Excel 2007, ThemeColor Light and Dark reversed

Hello Chris,

Thank you for reporting the issue of Office 2007. I have consulted Office
development team, and they confirmed that it is a known issue of the office
2007 which will be fixed in the next version of Office: Office 14.

A workaround for this bug is to set the property 'Color' instead of
'ThemeColor' because we can get the correct color through
ActiveWorkbook.Theme.ThemeColorScheme.Colors(msoTh emeLight1).RGB. Please
refer to the following codes:

Selection.Interior.Color =
ActiveWorkbook.Theme.ThemeColorScheme.Colors(msoTh emeLight1).RGB
Selection.Font.Color =
ActiveWorkbook.Theme.ThemeColorScheme.Colors(msoTh emeDark1).RGB

In this way, we do not need to worry about the break of the code, even if
the bug is fixed in future.

We, the newsgroup team, have also logged this issue for future reference.
Thank you again for your sharing.

Sincerely,
Jialiang Ge , remove 'online.')
Microsoft Online Community Support

==================================================
For MSDN subscribers whose posts are left unanswered, please check this
document: http://blogs.msdn.com/msdnts/pages/postingAlias.aspx

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express/Windows Mail, please make sure
you clear the check box "Tools/Options/Read: Get 300 headers at a time" to
see your reply promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 118
Default Excel 2007, ThemeColor Light and Dark reversed

Hello Chris,

Thank you for reporting the issue of Office 2007. I have consulted Office
development team, and they confirmed that it is a known issue of office
2007 which will be fixed in the next version of Office.

A workaround for this bug is to set the property 'Color' instead of
'ThemeColor' because we can get the correct color through
ActiveWorkbook.Theme.ThemeColorScheme.Colors(msoTh emeLight1).RGB. Please
refer to the following codes:

Selection.Interior.Color =
ActiveWorkbook.Theme.ThemeColorScheme.Colors(msoTh emeLight1).RGB
Selection.Font.Color =
ActiveWorkbook.Theme.ThemeColorScheme.Colors(msoTh emeDark1).RGB

In this way, we do not need to worry about the break of the code, even if
the bug is fixed in future.

We, the newsgroup team, have also logged this issue for future reference.
Thank you again for your feedback on our products and help us import them.
We have submitted request to document this issue as a KB article which
could benefit other developers in the future.

Please feel free to let me know if you have any concern or need anything
else.

Sincerely,
Jialiang Ge , remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 118
Default Excel 2007, ThemeColor Light and Dark reversed

Hello Chris,

Thank you for reporting the issue of Office 2007. I have consulted Office
development team, and they confirmed that it is a known issue of office
2007 which will be fixed in the next version of Office.

A workaround for this bug is to set the property 'Color' instead of
'ThemeColor' because we can get the correct color through
ActiveWorkbook.Theme.ThemeColorScheme.Colors(msoTh emeLight1).RGB. Please
refer to the following codes:

Selection.Interior.Color =
ActiveWorkbook.Theme.ThemeColorScheme.Colors(msoTh emeLight1).RGB
Selection.Font.Color =
ActiveWorkbook.Theme.ThemeColorScheme.Colors(msoTh emeDark1).RGB

In this way, we do not need to worry about the break of the code, even if
the bug is fixed in future.

We, the newsgroup team, have also logged this issue for future reference.
Thank you again for your feedback on our products and helping us improve
them.
We have submitted a request to document this issue as a KB article which
could benefit other developers in the future.

Please feel free to let me know if you have any concern or need anything
else.

Sincerely,
Jialiang Ge , remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Excel 2007, ThemeColor Light and Dark reversed

Thanks for confirming the bug.
Just to point out (to anyone else reading this) that the suggestion of
setting colours using the RGB values is not a full workaround, since those
colours will not subsequently change when the theme or colour scheme is
changed (which is the point of using theme colours in the first place).
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel 2007, ThemeColor Light and Dark reversed

Hi Chris,

This is Walter, community lead of the MSDN Managed Newsgroup Support Team.

Thank you so much for your feedback and sharing the workaround for this
issue. I believe that other community members will also benefit from your
experience sharing. Without the input of numerous intelligent and
warmhearted customers like you, our MSDN Managed Newsgroup can never be as
comprehensive and helpful as it is today. I appreciate your time and
efforts working with us.

I am contacting you to see whether there is anything we can do for you. If
you have any comments on our support service, website design, our product
limitation, our process, and etc., please don't hesitate to let me know. I
will do my best to follow up.

Thank you for using our MSDN Managed Newsgroup Support Service.


Regards,
Walter Wang , remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

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
Excel 2007 noncontiguous cell highlight color=light,light blue. How do I make it darker, or like Excel 2003 ( I'm extremely shade blind-PLZ HELP !! ) DCJM New Users to Excel 1 July 28th 11 12:49 PM
Excel 2007 noncontiguous cell highlight color=light,light blue. How do I make it darker, or like Excel 2003 ( I'm extremely shade blind-PLZ HELP !! ) DCJM Excel Discussion (Misc queries) 1 July 27th 11 10:42 PM
How do I control the light/dark variations Excel 2007 color theme? RuthMor Excel Discussion (Misc queries) 6 November 23rd 10 11:30 PM
Excel 2007 Traffic Light with dates Robert H Excel Discussion (Misc queries) 6 November 23rd 09 04:50 PM
why are some gridlines in an excel worksheet dark and some light? Joyal New Users to Excel 1 September 14th 05 03:01 AM


All times are GMT +1. The time now is 01:18 AM.

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"