View Single Post
 
Old 03-20-2025, 02:17 AM
Italophile Italophile is offline Windows 11 Office 2021
Expert
 
Join Date: Mar 2022
Posts: 542
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

The Word object model does not support setting the font color of a style to a theme color. The code below will generate an error if you try it.

Code:
ActiveDocument.Styles(wdStyleHeading1).Font.Fill.ForeColor.ObjectThemeColor = wdThemeColorAccent2
The negative RGB value isn't a constant but can be determined using the following code, where a theme color has already been applied to the style

Code:
Debug.Print ActiveDocument.Styles(wdStyleHeading1).Font.Color
If you work through each of the colors you can create your own constants. Watch out for tints and shades though!

If you're feeling brave, there is an article that explains theme colors in depth: Word Articles: Colours in 2007
Reply With Quote