Compare colors
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I need to override part color with default renderstyle color. So I get the default render style color (only the Ambient color), create a color based on RGB values, and compare with reference colors to use a Select case. But I cannot differentiate 2 colors created with CreateColors. Where is the problem ?
Dim oDoc As PartDocument
Dim couleur As Color, colRed As Color, colGreen As Color
Dim rr As Byte, gg As Byte, bb As Byte
Set oDoc = ThisApplication.ActiveDocument
oDoc.RenderStyles.Item("Par défaut").GetAmbientColor rr, gg, bb
'
'Create the color
Set couleur = ThisApplication.TransientObjects.CreateColor(rr, gg, bb)
'Create reference colors
Set colRed= ThisApplication.TransientObjects.CreateColor(255, 0, 0)
Set colGreen = ThisApplication.TransientObjects.CreateColor(0, 255, 0)
'Compare
select case couleur 'ALL THE CASES ARE TRUE !
case colRed
...
case colGreen
...
end select