IsOfficeAppPresent – Check whether an Office application is present

Enum mbOfficeAppConstants    mbWord = 0    mbAccess = 1    mbExcel = 2    mbPowerpoint = 3    mbOutlook = 4End Enum' Check whether the specified Office application is present' Note: require GetRegistryValue'' Example:'    Dim sDescr As String'    sDescr = "Word is installed: " & IsOfficeAppPresent(mbWord) & vbCrLf & '   '      "Access is installed: " & IsOfficeAppPresent(mbAccess) & vbCrLf & '      '   "Excel is installed: " & IsOfficeAppPresent(mbExcel) & vbCrLf & '        ' "Powerpoint is installed: " & IsOfficeAppPresent(mbPowerpoint) & vbCrLf & '   '      "Outlook is installed: " & IsOfficeAppPresent(mbOutlook)'    MsgBox sDescrFunction IsOfficeAppPresent(ByVal mbOfficeApp As mbOfficeAppConstants) As _    Boolean    Dim sApp As String    Const HKEY_CLASSES_ROOT = &H80000000        Select Case mbOfficeApp        Case mbWord            sApp = "Word.DocumentCurVer"        Case mbAccess            sApp = "Access.DatabaseCurVer"        Case mbExcel            sApp = "Excel.SheetCurVer"        Case mbPowerpoint            sApp = "PowerPoint.SlideCurVer"        Case mbOutlook            sApp = "Outlook.EnvelopeCurVer"    End Select    'if it reads a value, the key exists --> the application is installed    IsOfficeAppPresent = (Len(GetRegistryValue(HKEY_CLASSES_ROOT, sApp, _        "")) > 0)End Function

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: