Code Samples for Businesses, Schools & Developers

First Published 29 Nov 2025


The Quick Access Toolbar (QAT) uses shortcuts to provide quick access to frequently used commands and tools in Office applications. Its contents are fully customisable by users.
For many years, the QAT was fully integrated with the ribbon. Whilst its position could be changed (above / below the ribbon), the QAT could only be hidden by hiding the ribbon itself.
However, starting with Office 2021, it finally became possible to hide / show the QAT independently of the ribbon visibility.

Access Options - Quick Access Toolbar

QAT Options
Ribbon Dropdown Menu

Show Ribbon Dropdown Menu


Using the Options menu, it is also possible to specify whether or not command labels are shown alongside the QAT icon. However, for space reasons, this setting only applies when the QAT is displayed below the ribbon

QAT Labels Below Ribbon
The same functionality to manage the QAT is available in all Office apps. Perhaps surprisingly, the Office team didn't provide any method of achieving these results using code.
However, there is a way of doing so indirectly by editing the registry, either directly using the Regedit app or by using code.

NOTE: Editing the registry can cause unpredictable results if done incorrectly. Take care.


Manage the QAT using the registry

All QAT settings for each Office app are stored in the registry in individual subfolders at: HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Common\Toolbars

For each Office app there is a single REG_DWORD key QuickAccessToolbarStyle. Modifying the value changes the QAT position, shows/hides labels or hides the QAT itself.

QAT Registry Settings
The values are derived using bitwise (binary) addition where the individual component values in A2021, A2024 or A365 are:

QAT Component Values - Access
For example, QAT below ribbon (always shown expanded) with labels hidden = 16 + 1 + 512 = 529

The resulting output where the ribbon tabs are always shown (expanded) is as follows:

QAT Registry Values - Always Show Ribbon
In the case where only the ribbon tabs are shown the values are:

QAT Registry Values - Ribbon Tabs Only
For example, QAT below ribbon (tabs only) with labels hidden = 16 + 4 + 1 + 512 = 533

NOTE:
1.   Outlook has additional QAT style options depending to the feature in use.
2.   Older versions of Access prior to A2021 had fewer ribbon / QAT toolbar variations:

A2010 QAT Component Values
      As a result, the only possible values were:

A2010 Allowed Values


Manage the QAT using code

I am grateful to my colleague, Xevi Batlle, for suggesting this approach.

The registry values shown above can also be applied using VBA. Copy the following code into a standard module:


Option Compare Database
Option Explicit

Private Declare PtrSafe Function RegCreateKeyEx Lib "advapi32.dll" Alias "RegCreateKeyExA" ( _
ByVal hKey As LongPtr, ByVal lpSubKey As String, ByVal Reserved As Long, _
ByVal lpClass As String, ByVal dwOptions As Long, ByVal samDesired As Long, _
ByVal lpSecurityAttributes As LongPtr, phkResult As LongPtr, _
lpdwDisposition As Long) As Long

Private Declare PtrSafe Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" ( _
ByVal hKey As LongPtr, ByVal lpValueName As String, ByVal Reserved As Long, _
ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long

Private Declare PtrSafe Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As LongPtr) As Long

Const REG_SZ = 1
Const REG_DWORD = 4
Const KEY_SET_VALUE = &H2
Const KEY_CREATE_SUB_KEY = &H4
Const HKEY_CURRENT_USER = &H80000001

Public Sub SetQATStyle(ByVal StyleValue As Long)

'===========================================================================
' Author: Xevi Batlle
' Purpose: Set QuickAccessToolbarStyle (e.g. 20 = show the QAT in the ribbon, 276 = hide it)
'===========================================================================

Dim lngResult As Long
Dim hKey As LongPtr
Dim disp As Long

Dim sKey As String
sKey = "Software\Microsoft\Office\16.0\Common\Toolbars\Access"

' Create the key if it doesn't exist
lngResult = RegCreateKeyEx(HKEY_CURRENT_USER, sKey, 0&, vbNullString, 0&, _
KEY_SET_VALUE Or KEY_CREATE_SUB_KEY, 0&, hKey, disp)

If lngResult <> 0 Then
MsgBox "Could not create/open registry key. Error: " & lngResult, vbCritical
Exit Sub
End If

' Write the DWORD value
lngResult = RegSetValueEx(hKey, "QuickAccessToolbarStyle", 0&, REG_DWORD, StyleValue, 4&)

RegCloseKey hKey

If lngResult = 0 Then
MsgBox "QuickAccessToolbarStyle successfully set to " & StyleValue & vbCrLf & _
"Restart Access for the change to take effect.", vbInformation
Else
MsgBox "Failed to write value. Error: " & lngResult, vbCritical
End If
End Sub


The above code can now be used in e.g. A365 to implement various QAT styles by adding various procedures such as those below:


' Examples
Sub ShowQATAboveRibbonAlwaysShown()
SetQATStyle 16 ' (Hex 10)
End Sub

Sub ShowQATBelowRibbonAlwaysShown()
SetQATStyle 17 'Hex (11)
End Sub

Sub ShowQATAboveRibbonTabsOnly()
SetQATStyle 20 ' (Hex 14)
End Sub

Sub ShowQATBelowRibbonTabsOnly()
SetQATStyle 21 'Hex (15)
End Sub

Sub HideQATRibbonAlwaysShown()
SetQATStyle 272 '(Hex 110)
End Sub

Sub HideQATRibbonsTabsOnly()
SetQATStyle 276 '(Hex 114)
End Sub


Substitute other decimal values from the table above to achieve different QAT styles. In each case, the changes will only be implemented after Access is restarted.


Full-Screen Mode

Word, Excel, PowerPoint and Outlook also have an additional feature, Full-screen mode, which is available from the Show Ribbon dropdown menu.

Show Ribbon Dropdown Menu
When this is clicked the app is maximized and the title bar shrinks, with an ellipsis (. . .) added. Other screen items are removed allowing maximum space for the document being displayed.
For example in Excel:

Full Screen Mode - Excel
Clicking the ellipsis restores both the ribbon and QAT temporarily. Click anywhere in the open document to revert to full-screen mode.

Although Access (and Publisher) have the full-screen mode item in the Show Ribbon dropdown menu, it cannot be selected / implemented from the Show Ribbon dropdown menu.

Nevertheless, I have discovered that this mode CAN be implemented in Access, again by using the registry. Further details are provided in a companion article: Full Screen Mode in Access



Feedback

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

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



Colin Riddington           Mendip Data Systems                 Last Updated 29 Nov 2025



Return to Code Samples Page




Return to Top