Hi
I am using Word and Excel and need to set the colour of a series on a chart in Excel to be the same colour as the background colour of a cell in a table in Word.
Here's the cunning bit...
RGB(156, 186, 90) added to a table cell in Word produces a different colour in Excel (Word appears correct).
As I undersatnd RGB() returns a Long. I am creating an array of the colours, as such:
Word code:
Excel code:
My guess is that Excel and Word interpret that Long differently (Excel wrongly?). Is there a way of ensuring that it uses the correct colour?
I am using Word and Excel and need to set the colour of a series on a chart in Excel to be the same colour as the background colour of a cell in a table in Word.
Here's the cunning bit...
RGB(156, 186, 90) added to a table cell in Word produces a different colour in Excel (Word appears correct).
As I undersatnd RGB() returns a Long. I am creating an array of the colours, as such:
Code:
Dim arColours(100) As Long
arColours(0) = RGB(156, 186, 90)
arColours(1) = RGB(198, 81, 74)
arColours(2) = RGB(74, 130, 189)
arColours(3) = RGB(247, 251, 0)
arColours(4) = RGB(247, 109, 0)
arColours(5) = RGB(8, 182, 173)
arColours(6) = RGB(231, 56, 156)
arColours(7) = RGB(140, 146, 222)
arColours(8) = RGB(140, 69, 0)
For intCounter = 9 To 99
arColours(intCounter) = RGB(0, 0, 0)
Next intCounter
Word code:
Code:
For i = 0 to 8
wdApp.Selection.Shading.BackgroundPatternColor = arColours(i)
Next i
Excel code:
Code:
For i = 0 to 8
xlApp.ActiveChart.SeriesCollection(1).Points(i).Interior.Color = arColours(i)
Next i
My guess is that Excel and Word interpret that Long differently (Excel wrongly?). Is there a way of ensuring that it uses the correct colour?