Once I determine that Excel is installed on Windows, how can I programmatically tell if it is a licensed/registered copy using vb.net or C#

Michele Hobson 21 Reputation points
2021-11-05T02:54:36.393+00:00

While I was working on my application, my Office 365 subscription expired. The application has an export feature that will export the data into Excel if installed or open it as a formatted text document if not.

Although the subscription is expired, it still opens Excel.

Is there any way to check whether Excel is licensed/registered?

Code used to check for Excel installation:

Dim regKey As Object = My.Computer.Registry.ClassesRoot.OpenSubKey("Excel.Application", False).OpenSubKey("CurVer", False)
If regKey.GetValue("").ToString() Is Nothing Then
Return False
Else
Return True
End If

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,508 questions
Excel Management
Excel Management
Excel: A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.Management: The act or process of organizing, handling, directing or controlling something.
1,643 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Emily Hua-MSFT 27,526 Reputation points
    2021-11-05T09:02:01.323+00:00

    @Michele Hobson

    As tag "office-excel-itpro" focuses on general issue of Excel client. If you need the code of C#, I would like to suggest you post a new thread on Q&A forum with tag "dotnet-csharp", and confirm whether this team could help you. Thanks for your understanding.

    From the perspective of Office, you could use command below to check license status, such as Licensed, Notification or others.
    Search CMD, right-click the Command Prompt and run as administrator. Then copy and paste the command below in it, click Enter at last:
    cscript.exe "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" /dstatus
    (If you are running 32-bit Office on a 64-bit operating system)
    cscript.exe "%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs" /dstatus


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.