Code Samples for Businesses, Schools & Developers

First Published 30 Aug 2026 Last Updated 15 Sept 2026



The six new SysCmd actions released with version 2604 provide very useful information about the installed Office version.
For example
SysCmd(acSysCmdGetFullVersion) or SysCmd(720) give the full version info:

SysCmd 720
The other five new SysCmd values, 721 through to 725, provide the individual components of that information.

These new commands are available in all Click to Run Consumer editions (NOT LTSC) of Access from 2016 onwards as well in Access 365.

For more information see my earlier article: Access SysCmd Actions (Documented & Undocumented)

The new commands make it much easier to obtain the full Access version, build and bitness information from clients when they report issues.
It also helps with troubleshooting when forum members report possible Access bugs.

Unfortunately, none of the SysCmd actions include information about the Office license for the current user.
This is an important omission as certain features are only included with certain Office licenses.


For example, the Edge browser control and VBA Project Signing are only available in Access 365 and 2024. The new Zooming feature is only available in Access 365 version 2605 onwards.

To try and make this clearer, I recently wrote an article summarising the Access editions, versions and channels containing all the major Access features added in recent years: Summary of New And Upcoming Features

In fact, all Office Click-to-Run (C2R) versions from 2016 through to 365 have the same core code and are all designated Office 16.0.
The main difference is that some features are enabled or disabled in the various licensed editions.


This can cause confusion about the availability of specific features where different users are running identical Office versions, builds and release channels but have licenses for different Office editions e.g. 365 or 2021.

To further complicate matters, some workstations may have more than one user, each with their own unique Office license.
Only one copy of Office needs to be installed, but each user will have a different feature set.


Of course, users can take a screenshot of the Product Information in File | Backstage view:

Product Info
This DOES include the license information but omits the bitness (32-bit / 64-bit)

It was for all these reasons that when the new SysCmd actions were first released with version 2604, fellow Access MVP, Karl Donaubauer, and I both asked that the license info be added.
It is hoped that this will be done in a later update though there is no commitment to this being done as yet.


In the meantime, this article shows how the license information can be obtained easily from the registry using VBA code.



Getting License Information using VBA

The registry contains a huge amount of information about installed applications including Office. The main difficulty is finding the correct location for the information you need.

For example, information about the installed build and channel is available at: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\Configuration

Registry - Office Configuration
However, that location is of no use for the license info as that applies to the current user and not the machine.

A quick search showed that the information we require is available at:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Common\Licensing\LastKnownC2RProductReleaseId

In the example below, the current user has a Pro Plus Office 365 license and some additional entries.

Registry - Licensing Product IDs #2
Apparently the 4 products ending in IM are used in telemetry for tracking feature usage, managing diagnostics etc.

Another user account on the same machine has Home Premium Retail licenses for all Office 365 apps including Access as well as 2021 Volume (LTSC) licenses for Project and Visio.

Registry - Licensing Product IDs #1
To obtain this information using VBA, we just need a function to read the relevant registry key value. The code below uses WScript.Shell to do this:

Function GetCurrentUserAccessLicense() As String

Dim WSHShell As Object

Set WSHShell = CreateObject("WScript.Shell")
GetCurrentUserAccessLicense = WSHShell.RegRead("HKEY_CURRENT_USER\" & _
"SOFTWARE\Microsoft\Office\16.0\Common\Licensing\LastKnownC2RProductReleaseId\Access")
Set WSHShell = Nothing

End Function


Example output:

Office License From Code
Using this function in conjunction with SysCmd(720) will provide all the required information for bug reports etc.

You can replace the Office product name in the function to get the license info for other Office products e.g. Visio

Function GetCurrentUserVisioLicense() As String

Dim WSHShell As Object

Set WSHShell = CreateObject("WScript.Shell")
GetCurrentUserVisioLicense = WSHShell.RegRead("HKEY_CURRENT_USER\" & _
"SOFTWARE\Microsoft\Office\16.0\Common\Licensing\LastKnownC2RProductReleaseId\Visio")
Set WSHShell = Nothing

End Function


In this case, we get:

Visio License From Code
NOTE:
If the selected Office product is not installed, the above code will trigger error -2147024894 (&H80070002):

Registry Key Missing Error
The following solution with error handling is more robust and was suggested by Axel Heyne:

Public Enum MicrosoftOfficeProduct
Access = 1: Excel = 2: Lync = 3: OneNote = 4: Outlook = 5: PowerPoint = 6: Publisher = 7: Project = 8: Visio = 9: Word = 10
End Enum

Public Function GetCurrentUserMicrosoftOfficeProductLicense(ByVal xMicrosoftOfficeProduct As MicrosoftOfficeProduct) As String

Const PROCEDURE_NAME As String = "GetCurrentUserMicrosoftOfficeProductLicense()"

On Error GoTo Err_Handler

Const MICROSOFT_OFFICE_LICENSING_KEY As String = _
"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Common\Licensing\LastKnownC2RProductReleaseId"

Dim officeProductName As String
officeProductName = _
Choose(xMicrosoftOfficeProduct, _
"Access", "Excel", "Lync", "OneNote", "Outlook", "PowerPoint", "Publisher", "Project", "Visio", "Word")

With CreateObject("WScript.Shell")
GetCurrentUserMicrosoftOfficeProductLicense = _
.RegRead(MICROSOFT_OFFICE_LICENSING_KEY & "\" & officeProductName)
End With

Exit_Handler:
Exit Function

Err_Handler:
Const ERR_UBABLE_TO_OPEN_REGISTRY_KEY As Long = &H80070002

If Err.Number = ERR_UBABLE_TO_OPEN_REGISTRY_KEY Then
GetCurrentUserMicrosoftOfficeProductLicense = _
"Can't determine license of Microsoft Office product »" & officeProductName & "«"
Else
MsgBox Err.Number & " : " & Err.Description, vbCritical, PROCEDURE_NAME
End If

Resume Exit_Handler

End Function


Example Usage:

Example Usage
Using the Enum value (e.g. 1) or the full Enum description (e.g. MicrosoftOfficeProduct.Access) will ALWAYS work.

Alternatively, you can also use the product name . . . but with one exception. The product name cannot be used when it is also used as a library reference (as the library name has a higher priority than the Enum member).

Code run from Access Code run from Excel
Expected Variable Error - in Access Expected Variable Error - in Excel


If you have references to e.g. both Access & Excel, both usages will fail (but all others in the list will work). Hopefully that all makes sense!



Other Useful Information

Occasionally, Office bugs are language specific. For that reason, it can also be useful to get the current Office language info using code.
VBA code to obtain the Office and Windows language info is available in a separate article: Get Office/Windows Language Info Using Code<


Feedback

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

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

Colin Riddington Mendip Data Systems Last Updated 15 Sept 2026




Return to Code Samples Page


Return to Top