Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Event when Word 2007 changes the theme

Tags:

c#

ms-word

vsto

Is there an event I can register from my VSTO application that is fired when the theme of Word 2007 is changed?

like image 676
crauscher Avatar asked Sep 04 '09 08:09

crauscher


1 Answers

As crauscher said, Office doesn't seem to trigger any public event when the theme for an Office 2007 application is changed by the user.

The easiest you could do is to poll the registry key at regular intervals to see if there was a change:

Office 2007: HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Common\Theme
Office 2010: HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Common\Theme

Where Theme is 1 for Blue, 2 for Silver and 3 for the Black scheme.

This article gives you some C# code you can use and modify: Setting the BackColor to match the Office 2007 color scheme

like image 189
Renaud Bompuis Avatar answered Sep 25 '22 00:09

Renaud Bompuis