Check if what version of Word is installed

blabore

Well-known member
Joined
Jan 31, 2002
Messages
48
Location
Austin, TX
Check what version of Word is installed

Does anyone know of a way to check if Word is installed, and what version it is? I currently just try to instanitate a Word Application object, and handle the error to indicate word isnt available, but this is pretty much a hack. Any suggestions would be appreciated. Thanks, Ben
 
Last edited by a moderator:
Ben,

For MS Word versions starting 9.0 (2000) you can check the existence of the registry key:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\<MS Office version>\Access\InstallRoot]

e.g. for MS Word 2000 this will be the key:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\9.0\Access\InstallRoot]

For MS Office 97 I think youve to check the existence of the system registry value BinDirPath under

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\8.0]

read this value - e.g. Ive it here as

"BinDirPath"="D:\\Program Files\\MSOffice\\97\\Office"

and then concatenate it with winword.exe - it will be:

D:\Program Files\MSOffice\97\Office\winword.exe

for the sample value above and see if this file exists of not.

HTH,
Shamil
 
Ben,

Sorry, I did post wrong registry keys (form MS Access instead of MW Word) - here how they should have been posted:

For MS Word versions starting 9.0 (2000) you can check the existence of the registry key:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\<MS Office version>\Word\InstallRoot]

e.g. for MS Word 2000 this will be the key:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\9.0\Word\InstallRoot]

For MS Office 97 I think youve to check the existence of the system registry value BinDirPath under

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\8.0]

read this value - e.g. Ive it here as

"BinDirPath"="D:\\Program Files\\MSOffice\\97\\Office"

and then concatenate it with winword.exe - it will be:

D:\Program Files\MSOffice\97\Office\winword.exe

for the sample value above and see if this file exists of not.

HTH,
Shamil
 
Ben,

Here is the function, which should help you (tested with MS Office 2000 only):

Public Function MsWordFullPath(ByVal vlngVersion As Long) As String
Given MS Word version number returns its FullPath if its installed, empty string ("") otherwise
Note: MS Office versions supported: 8 and above
Dim objRegKey As Microsoft.Win32.RegistryKey
Dim strKeyName As String
Dim strValueName As String
Dim strValue As String

strKeyName = "SOFTWARE\\Microsoft\\Office\\" & vlngVersion.ToString & ".0\\Common\\InstallRoot"
Select Case vlngVersion
Case Is < 8
strValueName = ""
strValue = ""
Case 8
strValueName = "OfficeBin"
Case Is > 8
strValueName = "Path"
End Select

If Microsoft.VisualBasic.Len(strValueName) > 0 Then
objRegKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(strKeyName, False)
If (objRegKey Is Nothing) Then
strValue = ""
Else
strValue = objRegKey.GetValue(strValueName)
If Microsoft.VisualBasic.Len(strValue) > 0 Then
If Microsoft.VisualBasic.Right(strValue, 1) <> "\" Then strValue = strValue & "\"
strValue = strValue & "winword.exe"
If Not System.IO.File.Exists(strValue) Then strValue = ""
End If
objRegKey.Close()
End If
End If
Return (strValue)
End Function


HTH,
Shamil
 
Back
Top