MS Access: Changing the Color Scheme programmatically

Saturday, May 3, 2008

technology02.pngMicrosoft Office 2007 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.

Luckily for us, Office 2007 stores the global colour scheme setting in the registry under: HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Common\Theme

The values being stored under that key are:

  1. Blue scheme
  2. Silver scheme
  3. 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.

Office 2007 Colour Schemes

You can download the sample database as it contains all necessary files, including the definition for the Win32 API functions.

DownloadDownload the ColorScheme.zip (31KB) containing the ACCDB database.

The sample also contains some code to restart the database. It will probably be the subject of a next post.

Improvements/uses:

  • 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).

References:

Entry Filed under  :  Database, MSAccess, Programming

1 Comment Add your own

  • 1. Access Team Blog&hellip  |  May 6th, 2008 at 8:47 am

    Follow up to Transparency Forms…

    Renaud posted some comments to the previous post about transparency forms and made some really cool enhancements…

Leave a Comment

hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Most Recent Posts

Categories

Links