Is there a way to trigger a macro when a shape's background color is set? The reason I was wondering is I'd like to automatically:
- change the text to black if it's a light background, or ...
- change the text to white if it's a dark background
Is there a way to trigger a macro when a shape's background color is set? The reason I was wondering is I'd like to automatically:
- change the text to black if it's a light background, or ...
- change the text to white if it's a dark background
Office 2010, Windows 7
goal: to learn the most efficient way
By the way, I was hoping to utilize this formula to determine the White/Black values:
http://www.codeproject.com/cs/media/IdealTextColor.asp
I just need to know if I can use the macro as some sort of trigger, or if I should do it on all shapes on the current slide, or something.
Office 2010, Windows 7
goal: to learn the most efficient way
Well, I decided to go at this from a different perspective. Since we use very specific colors at work (a template), I decided to just change it to a subset of only those colors, so I know if the text should go white or black automatically.
If anyone knows of a way to trigger this whenever a fill color is changed, I'd still like to know just for learning purposes.
Office 2010, Windows 7
goal: to learn the most efficient way
How would I turn this into a CASE statement?
[vba]
With ActivePresentation.Slides(mySlide).Shapes
If .Range.HasTextFrame Then
If .Range.Fill.ForeColor.RGB = RGB(255, 255, 255) Then
.Range.TextFrame.TextRange.Font.Color.RGB = RGB(0, 0, 0)
End If
[/vba]
... NEVERMIND
I figured it out.
[VBA]
For Each shp In ActivePresentation.Slides(mySlide).Shapes
If shp.HasTextFrame Then
Select Case shp.Fill.ForeColor.RGB
Case Is = RGB(255, 255, 255) 'white
shp.TextFrame.TextRange.Font.Color.RGB = RGB(0, 0, 0)
[/VBA]
Last edited by TrippyTom; 03-02-2007 at 01:00 PM.
Office 2010, Windows 7
goal: to learn the most efficient way