Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Dec 2001
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Check for existence of Excel (xp pro)

    Would like to check to see if a system has a particular application installed. In this example assume it is Excel. Is this a good method to check if excel is installed?

    Dim objExcelApp As New Excel.Application
    If Val(objExcelApp.Application.Version) = 0 Then
    msgbox "Excel not installed"
    end if

    Thanks

    Kim

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Check for existence of Excel (xp pro)

    I'm not sure what error that would invoke in the absence of Excel, but I don't think it would work as planned. Perhaps easier to try to read a value out of the registry?

  3. #3
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Check for existence of Excel (xp pro)

    Maybe this helps:

    <pre>Option Explicit

    Function OpenApp(ByVal sAppname As String, ByRef bSuccess As Boolean) As Object
    Dim oApp As Object
    On Error Resume Next
    Set oApp = CreateObject(sAppname)
    If Err.Number = 0 Then
    Set OpenApp = oApp
    bSuccess = True
    Else
    bSuccess = False
    End If
    Set oApp = Nothing
    End Function

    Sub test()
    Dim oXLApp As Object
    Dim sAppname As String
    Dim bSuccess As Boolean
    sAppname = "excel.application"
    Set oXLApp = OpenApp(sAppname, bSuccess)
    If bSuccess = False Then
    MsgBox "Failed to start " & sAppname
    Else
    MsgBox "successfully started " & sAppname & vbNewLine _
    & "version is: " & oXLApp.Version
    oXLApp.Quit
    Set oXLApp = Nothing
    End If

    End Sub
    </pre>

    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  4. #4
    New Lounger
    Join Date
    Dec 2001
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Check for existence of Excel (xp pro)

    Many thanx for the response. One slight mod for y app and it works like a charm.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •