isladogs
Access MVP / VIP
- Local time
- Today, 05:44
- Joined
- Jan 14, 2017
- Messages
- 19,376
When distributing applications, a common request is for the appearance of Access forms to be automatically updated in line with the currently selected Office UI theme. The attached database demonstrates one way that this can be done. It includes all required code.
From Office 2016 onwards, Office applications have provided four different Office themes: Colourful, White, Black and Dark Grey with the default being Colourful. It is also possible to specify Use System Settings so that the Office theme is based on the Windows theme:
Windows Light theme maps to Colourful; Windows Dark Theme maps to Black.
NOTE: Office themes alter the appearance of the user interface.
They are not the same as Access themes which can be used to alter the appearance of Access forms and reports
In this case, I am using the Office theme to update the appearance of Access forms.
In order to create forms whose appearance is automatically updated with the Office theme, it is first necessary to get the Office UI theme using code.
This is done by reading the registry key: HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Common\UI Theme.
I then use a series of functions on Form_Load which update different form components (mostly) using the Fluent UI theme colours.
The Refresh Form button will update the form if the theme is changed after a form is loaded.
Note that the purpose here is to show what can be done rather than follow strict fluent UI guidelines. The colours can be changed to suit individual preferences
Here are the results for two forms using the default Colourful theme
And again, this time in Dark Grey theme
And again in White theme:
And finally in black theme:
For a more detailed explanation of the process and code used, see my recent article:
www.isladogs.co.uk
I have also created a short YouTube video showing this in action:
From Office 2016 onwards, Office applications have provided four different Office themes: Colourful, White, Black and Dark Grey with the default being Colourful. It is also possible to specify Use System Settings so that the Office theme is based on the Windows theme:
Windows Light theme maps to Colourful; Windows Dark Theme maps to Black.
NOTE: Office themes alter the appearance of the user interface.
They are not the same as Access themes which can be used to alter the appearance of Access forms and reports
In this case, I am using the Office theme to update the appearance of Access forms.
In order to create forms whose appearance is automatically updated with the Office theme, it is first necessary to get the Office UI theme using code.
This is done by reading the registry key: HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Common\UI Theme.
| Office UI Theme Name | Office UI Theme Value |
|---|---|
| Dark Grey | 3 |
| Black | 4 |
| White | 5 |
| Use system settings | 6 |
| Colourful | 7 |
I then use a series of functions on Form_Load which update different form components (mostly) using the Fluent UI theme colours.
The Refresh Form button will update the form if the theme is changed after a form is loaded.
Note that the purpose here is to show what can be done rather than follow strict fluent UI guidelines. The colours can be changed to suit individual preferences
Here are the results for two forms using the default Colourful theme
And again, this time in Dark Grey theme
And again in White theme:
And finally in black theme:
For a more detailed explanation of the process and code used, see my recent article:
Create Theme-Aware Forms in Access
This article demonstrates how to detect the Office UI Theme using code and modify the appearance of forms to blend with the current Office theme. An example app is supplied.
I have also created a short YouTube video showing this in action:
Attachments
Last edited: