Saturday, May 3, 2008
Microsoft Office 2007/2010 comes with 3 colour (color) schemes.
Users can easily change it but when you deploy an Access application under the Runtime your users have no way to set the colour scheme as the application’s options are not available.
(Article and Code Updated 31MAY2011.)
Luckily for us, Office 2007 stores the global colour scheme setting in the registry under:
and Office 2010 in:
The values being stored under that key are:
- Blue scheme
- Silver scheme
- Black scheme
With this information, we can easily both read and set the colour scheme. The only caveat is that I could not find a way to notify Access to reload the setting automatically once it is changed, so users will have to restart the application before the change becomes active. A small price to pay but if anyone has a better idea, please let me know.
To write the new value to the registry I use a set of WIN 32 APIs that are more flexible than the default ones provided in VBA.
You can download the sample database as it contains all necessary files, including the definition for the Win32 API functions.
Download the ColorSchemeV1.3.zip (31KB) containing the ACCDB database.
The sample also contains some code to restart the database. This is the subject of another post: Restarting and compacting the database programmatically.
- Find a way for Access to reload the settings without having to restart the application.
- Use the knowledge about the current scheme to change the other colour settings in the application (or even adapt the form’s theme).
- 31MAY2011: added support for Office 2010.
- Setting the BackColor to match the Office 2007 color scheme
- API Get / Set Registry functions from http://www.arcatapet.net/.