|
Language: VB5,VB6 Expertise: Intermediate
Jul 16, 2001
WEBINAR:
On-Demand
Application Security Testing: An Integral Part of DevOps
IsOfficeAppPresent - Check whether an Office application is present
Enum mbOfficeAppConstants
mbWord = 0
mbAccess = 1
mbExcel = 2
mbPowerpoint = 3
mbOutlook = 4
End 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 sDescr
Function IsOfficeAppPresent(ByVal mbOfficeApp As mbOfficeAppConstants) As _
Boolean
Dim sApp As String
Const HKEY_CLASSES_ROOT = &H80000000
Select Case mbOfficeApp
Case mbWord
sApp = "Word.Document\CurVer"
Case mbAccess
sApp = "Access.Database\CurVer"
Case mbExcel
sApp = "Excel.Sheet\CurVer"
Case mbPowerpoint
sApp = "PowerPoint.Slide\CurVer"
Case mbOutlook
sApp = "Outlook.Envelope\CurVer"
End Select
'if it reads a value, the key exists --> the application is installed
IsOfficeAppPresent = (Len(GetRegistryValue(HKEY_CLASSES_ROOT, sApp, _
"")) > 0)
End Function
Marco Bellinaso
|
 |
|
|
|
|
|
|