How to find that MS Word is installed on the machine or not in VB.Net

You can know that MS Word is installed in the machine or not in VB.Net. following code sample shows this with the help of registry entries.

First you need to import the namespace in the top like this:

Imports Microsoft.Win32

Then the following example is searching ‘Computer\HKEY_CLASSES_ROOT\Word.Application’ registry key in the registry system to know whether the ms word application is install or not.

    Private Sub IsWordInstalled()
        Dim oKey As RegistryKey
        Dim oSubKey As RegistryKey = Nothing
 
        oKey = Registry.ClassesRoot
        oSubKey = oKey.OpenSubKey("Word.Application")
        If Not oSubKey Is Nothing Then
            MessageBox.Show("MS Word is installed in this machine.")
        Else
            MessageBox.Show("MS Word is not installed in this machine.")
        End If
        oKey.Close()
    End Sub