Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 03-20-2025, 02:17 AM
Italophile Italophile is offline In a style set font color to themecolor Windows 11 In a style set font color to themecolor 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
 

Tags
color, style, theme



Similar Threads
Thread Thread Starter Forum Replies Last Post
Style Font Color Changes After Close?? the.ronin Word 2 05-20-2018 07:26 PM
Style Font Color: Background 1 gmgj Word 3 12-20-2017 04:00 PM
In a style set font color to themecolor Hyperlink style won't accept font color or underlining Jennifer Murphy Word 14 03-19-2017 03:02 PM
Font Color Question//.Replacement.Font.Color = 12611584 rsrasc Word VBA 3 09-05-2015 09:03 PM
Setting Font Color and Style "permanently" wings1080 Word 5 12-19-2014 08:44 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:38 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft