View Single Post
 
Old 03-19-2025, 05:52 PM
Astrid Astrid is offline Windows 10 Office 2019
Novice
 
Join Date: Apr 2022
Posts: 9
Astrid is on a distinguished road
Default In a style set font color to themecolor

I like to set the color of a font in a paragraph style to an accentcolor (from the document theme).

On a range I can use:
Selection.Font.Fill.ForeColor.ObjectThemeColor =wdThemeColorAccent2

however if I try to apply the color to a font in a style, I get an error 4680 (That property is not supported for this object)
ActiveDocument.Styles(wdStyleHeading1).Font.Fill.F oreColor.ObjectThemeColor = wdThemeColorAccent2

I can set the color if I use
ActiveDocument.Styles(wdStyleHeading1).Font.Color = ActiveDocument.DocumentTheme.ThemeColorScheme(msoT hemeAccent2)
however it doesn't point to the position in the theme but uses it's RGB. That's not what I want.
(Note that the .Color property of a font still works)

Does anybody know how to archieve this?
I was also wondering why I need the msoThemeAccent enum instead of the wdThemeColorAccent. I was under the impression that for Word objects I need the wdThemeColorAccent and for Office objects the msoThemeColor?
Reply With Quote