Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: VB5,VB6
Expertise: Intermediate
Jul 16, 2001

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
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date