Example Apps for Businesses, Schools & Developers

Version 1.3           Approx 0.75 MB (zipped)                 First Published 15 Jan 2026                 Last Updated 20 Jan 2026


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.
This article explains how this can be done and includes an example database together with all required code.

From Office 2016 onwards, Office applications have provided four different Office themes: Colourful, White, Black and Dark Grey.

The default is Colourful which gives an application specific title bar colour: Access (dark red), Excel (green), Outlook (blue) etc.
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.

The theme is selected from the Options | General dialog of any Office app and is applied consistently across all Office apps.

Office Theme Options
The theme values are as follows:

Office UI Theme Name Office UI Theme Value
Dark Grey 3
Black 4
White 5
Use system settings 6
Colourful 7


NOTE: Theme names and spellings will vary depending on Office language / locale but the UI values are consistent.

These values are stored in the registry at: HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Common\UI Theme

Registry UI Theme


Get the Office theme using Code

This is easily done by reading the registry. Place the following code in a standard module:


Option Compare Database
Option Explicit

' ============================================================
' Author: Colin Riddington
' Company: Mendip Data Systems
' Website: https://isladogs.co.uk
' Purpose: Theme-aware UI module for Microsoft Access
' Detects Office theme and exposes colour palettes
' Last Updated: 2026-01-14
' ============================================================

' Office theme registry values:
' 3 = Dark Grey
' 4 = Black
' 5 = White
' 6 = Use System Settings
' 7 = Colorful

' For non-English UK users, update the theme names in tblUITheme to match those in Access Options | General

' Windows AppsUseLightTheme values:
' 0 = Dark Mode
' 1 = Light Mode

' ============================================================

Public Function GetCurrentOfficeTheme() As Long

Dim regTheme As Variant
regTheme = ReadReg("HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Common\UI Theme")

Select Case regTheme

Case 0
GetCurrentOfficeTheme = 7 'default is Colorful
Case 6 'use system settings
GetCurrentOfficeTheme = ResolveSystemTheme()
Case Else '3,4,5,7
GetCurrentOfficeTheme = CLng(regTheme)

End Select

End Function

Public Function GetCurrentOfficeThemeName() As String
GetCurrentOfficeThemeName = Nz(DLookup("Theme", "tblUITheme", "UIThemeID = " & GetCurrentOfficeTheme), "Unknown")
End Function

Private Function ResolveSystemTheme() As String
Dim winMode As Variant
winMode = ReadReg("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize\AppsUseLightTheme")

If IsNull(winMode) Then
ResolveSystemTheme = 7 'Colourful ' Office default fallback
Exit Function
End If

If CLng(winMode) = 0 Then
ResolveSystemTheme = 4 'Black ' Windows Dark Mode => Office Black
Else
ResolveSystemTheme = 7 'Colourful ' Windows Light Mode => Office Colorful
End If
End Function

Private Function ReadReg(path As String) As Variant
On Error Resume Next
Dim wsh As Object
Set wsh = CreateObject("WScript.Shell")
ReadReg = wsh.RegRead(path)
End Function


The GetCurrentOfficeTheme function returns the registry key value: 3/4/5/6/7.

If the returned value = 6, the code uses the ResolveSystemeTheme function to obtain the effective Office theme value.
This is done by reading another registry key:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize\AppsUseLightTheme

Registry App Use Light Theme.png
The key values are Dark Mode = 0; Light Mode = 1 and result in Black and Colourful Office UI themes respectively.

NOTE:
1.   The Office theme names and spellings will vary depending on the Office language and locale. In the attached database, the theme names for English (UK) are stored in the table tblUITheme

Theme Names
      If you are using another Office language, you should update the Theme names as necessary in this table as the values are used in the GetCurrentOfficeThemeName function.

2.   Although the registry UI Theme value can easily be edited either manually or using code, doing so has no effect on the Office theme.
      The values 1, 2 and 3 were originally used to denote the various Office 2007 / 2010 theme colours (silver / blue / black).
      At that time, it was possible to edit the theme colurs by editing the registry.

      This no longer works as the values are now stored in the cloud. The registry key values are still used but only for backwards compatibility.

      Nevertheless, we can still reliably use the registry key values to detect the Office theme and then modify the appearance of our forms.



The Example App

The example app has two forms whose appearance is automatically updated with the Office theme.

I have made no attempt to follow the Fluent UI guidelines published by Microsoft. My purpose here was to show how forms could be modified to blend in with each theme.

Using the default Colourful theme, the forms look like this:

Colourful theme
Changing to Black theme, the appearance of each form changes to:

Black theme
Changing again to Dark Grey theme, the forms now look like this:

Dark Grey theme
Finally changing to White theme, the forms change to this:

White theme
Each form (including the datasheet subform) is automatically updated in line with the current theme when it is opened.
If you change themes whilst a form is open, click the Refresh Form buttons on each form to update the appearance.. The changes are instantaneous.

Most of the code that manages this is also part of the standard module modOfficeTheme. The main procedure is called ApplyThemeToForm:


' ------------------------------------------------------------
' Apply theme to a form and its controls
' ------------------------------------------------------------
Public Sub ApplyThemeToForm(frm As Form)

'v1.3 - handle error 2465 triggered if form has no header / footer
On Error Resume Next

Dim ctl As Control

frm.Detail.BackColor = ThemeBackColor()
frm.FormHeader.BackColor = OfficeAccentColor()
frm.FormFooter.BackColor = OfficeAccentColor()

For Each ctl In frm.Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox, acListBox, acLabel, acTabCtl
ctl.ForeColor = ThemeTextColor()
ctl.BackColor = ThemeSecondaryBackColor()

Case acLine
ctl.BorderColor = ThemeTextColor 'ThemeBorderColor()

Case acCommandButton, acToggleButton
ctl.BackColor = OfficeAccentColor()
ctl.ForeColor = ThemeTextColor()

End Select
Next ctl
End Sub


This code depends on various helper functions.
With one exception, the colours used in each function are based on what I believe are the values used by Access for each UI theme. These values are stored in the table, tblThemeColors.


' ------------------------------------------------------------
' Accent Colours
' ------------------------------------------------------------
Public Function OfficeAccentColor() As Long
Select Case GetCurrentOfficeTheme()

Case 3 'dark grey
OfficeAccentColor = RGB(63, 63, 70)

Case 4 'black
OfficeAccentColor = RGB(0, 0, 0)

Case 5 'White
OfficeAccentColor = RGB(255, 255, 255)

Case 7 'colorful
OfficeAccentColor = RGB(164, 55, 58) ' #A4373A 'AccessAccentColor()


End Select
End Function

' ------------------------------------------------------------
' Neutral background colours for forms
' ------------------------------------------------------------
Public Function ThemeBackColor() As Long
Select Case GetCurrentOfficeTheme()

Case 3 'Dark Grey
ThemeBackColor = RGB(81, 81, 81) 'RGB(63, 63, 70)

Case 4 'Black
ThemeBackColor = RGB(30, 30, 30) 'RGB(0, 0, 0)

Case 5 'White
ThemeBackColor = RGB(243, 243, 243)

Case 7 'Colourful
ThemeBackColor = RGB(243, 243, 243)
End Select

'Debug.Print ThemeBackColor
End Function

' ------------------------------------------------------------
' Secondary background colours for controls e.g. textboxes, combos
' ------------------------------------------------------------
Public Function ThemeSecondaryBackColor() As Long
Select Case GetCurrentOfficeTheme()

Case 3 'Dark Grey
ThemeSecondaryBackColor = RGB(81, 81, 81)

Case 4 'Black
ThemeSecondaryBackColor = RGB(30, 30, 30)

Case 5 'White
ThemeSecondaryBackColor = RGB(243, 243, 243)

Case 7 'Colourful
ThemeSecondaryBackColor = RGB(243, 243, 243)
End Select

End Function

' ------------------------------------------------------------
' Text colour for forms
' ------------------------------------------------------------
Public Function ThemeTextColor() As Long

Select Case GetCurrentOfficeTheme()

Case 3, 4 'Dark Grey, Black
ThemeTextColor = RGB(255, 255, 255)
Case 5, 7 'White, Colourful
ThemeTextColor = RGB(0, 0, 0)

End Select

End Function

' ------------------------------------------------------------
' Secondary Text colour for forms
' ------------------------------------------------------------
Public Function ThemeSecondaryTextColor() As Long

Select Case GetCurrentOfficeTheme()

Case 3 'Dark Grey
ThemeSecondaryTextColor = RGB(200, 200, 200)

Case 4 'Black
ThemeSecondaryTextColor = RGB(212, 212, 212)

Case 5 'White
ThemeSecondaryTextColor = RGB(166, 166, 166)

Case 7 'Colourful
ThemeSecondaryTextColor = RGB(166, 166, 166)
End Select

End Function

' ------------------------------------------------------------
' Border colours for controls e.g. textboxes, combos
' ------------------------------------------------------------
Public Function ThemeBorderColor() As Long

Select Case GetCurrentOfficeTheme()

Case 3 'Dark Grey
ThemeBorderColor = RGB(81, 81, 81)

Case 4 'Black
ThemeBorderColor = RGB(60, 60, 60)

Case 5 'White
ThemeBorderColor = RGB(208, 208, 208)

Case 7 'Colourful
ThemeBorderColor = RGB(208, 208, 208)
End Select

End Function

' ------------------------------------------------------------
' Alternate Row Colors for datasheets (unofficial)
' I have chosen these as 'muted' versions of the OfficeAccentColor for each theme
' ------------------------------------------------------------
Public Function ThemeDSAltRowColor() As Long

Select Case GetCurrentOfficeTheme()

Case 3 'Dark Grey
ThemeDSAltRowColor = RGB(144, 144, 144)

Case 4 'Black
ThemeDSAltRowColor = RGB(127, 127, 127)

Case 5 'White
ThemeDSAltRowColor = RGB(208, 208, 208)

Case 7 'Colourful
ThemeDSAltRowColor = RGB(208, 100, 100)
End Select

End Function


As stated in the code above, the colours specified by the function ThemeDSAltColors are not part of the official theme colors.
I have used this function to provide 'muted' versions of the OfficeAccentColor as a suitable colour for datasheet alternate rows.

Both forms run a procedure called UpdateFormColors in the Form_Load event. This does the following:
•   detects the current Office theme and displays the theme name
•   runs the ApplyThemeToForm procedure which updates the colours of all the form sections and controls
•   optionally runs code to manage any exceptions to the default values (if necessary).
     For example in the main form, the UpdateFormColors procedure has several exceptions when the Colorful theme is used:


Private Sub UpdateFormColors()

Me.lblTheme.Caption = "The current Office UI Theme is " & GetCurrentOfficeThemeName

ApplyThemeToForm Me

'contrast button in header with header section colour
Me.cmdQuit.BackColor = ThemeBackColor

'manage exceptions for Colourful theme
If GetCurrentOfficeTheme = 7 Then
Me.lblHeader.ForeColor = ThemeBackColor
Me.cmdRefresh.ForeColor = ThemeBackColor
Me.cmdNew.ForeColor = ThemeBackColor
Me.lblVersion.ForeColor = ThemeBackColor
Me.lblMDS.ForeColor = ThemeBackColor
End If

End Sub


Similar modifications have been done in the second form.


Private Sub UpdateFormColors()

Me.lblTheme.Caption = "The current Office UI Theme is " & GetCurrentOfficeThemeName

ApplyThemeToForm Me

'apply current theme to combo & listbox
Me.cboThemes = GetCurrentOfficeTheme
Me.lstThemes = GetCurrentOfficeTheme

Me.fsubSettings.Form.DatasheetBackColor = ThemeSecondaryBackColor
Me.fsubSettings.Form.DatasheetAlternateBackColor = ThemeDSAltRowColor
Me.fsubSettings.Form.DatasheetForeColor = ThemeTextColor


'contrast button in header with header section colour
Me.cmdClose.BackColor = ThemeBackColor

'manage exceptions
Select Case GetCurrentOfficeTheme

Case 3, 4 'dark grey, black
Me.lstThemes.ForeColor = ThemeSecondaryTextColor
Me.cmdRefresh.BackColor = ThemeSecondaryBackColor
Me.tgl1.BackColor = ThemeSecondaryBackColor
Case 5 'white

Case 7 'colourful
Me.lblHeader.ForeColor = ThemeBackColor
Me.cmdRefresh.ForeColor = ThemeBackColor
Me.cmdClose.BackColor = ThemeBackColor
Me.lblVersion.ForeColor = ThemeBackColor
Me.lblMDS.ForeColor = ThemeBackColor
Me.TabCtl1.BackColor = OfficeAccentColor
Me.TabCtl1.ForeColor = ThemeBackColor
Me.tgl1.ForeColor = ThemeBackColor
End Select

End Sub


The UpdateFormColors procedure also runs when the Refresh Form button is clicked.

If you are interested in applying the ideas from this article in your own apps, I suggest you first experiment with the example app.
You can try changing any of the values in the code to see the effects of your changes in each case.

NOTE: I STRONGLY recommend you make a backup before making any changes to the example app.



Alternative Approach

You could instead specify built-in Access themes (or create your own) to use with each of the Office UI themes.
When the Office UI theme is changed, update all forms to the corresponding Access theme.

I may write an article about this approach in the future. For more information on using Access themes effectively, see the ThemeMyDatabase add-in by Peter Cole.



Video

I have created a short YouTube video (04:17) to demonstrate this using the example app.

You can watch the Create Theme-Aware Forms in Access video on my Isladogs YouTube channel or you can click below:



If you liked the video, please subscribe to my Isladogs on Access channel on YouTube. Thanks.



Version History

Version Release Date Notes
1.2 2016-01-15 Initial release
1.3 2016-01-20 Added test form frmThemeControlsDetailOnly
Added error handling to ApplyThemeToForm code to manage error 2465 where no form header / footer exists.
Thanks to Peter Cole for reporting this issue.




Download

Click to download:           Office UI Theme_v1.3    Approx 0.75 MB   (ACCDB - zipped)



Feedback

Please use the E-Mail button in the contact form below to let me know whether you found this article useful or if you have any questions.

If there is sufficient interest, I may do a follow-up article showing how to apply fluent UI guidelines for each component of a form in the four Office themes.

Please also consider making a donation towards the costs of maintaining this website. Thank you



Colin Riddington           Mendip Data Systems                 Last Updated 20 Jan 2026



Return to Example Databases Page




Return to Top