Discover installed version of Excel (and service packs)

I need to determine which version of Excel that I installed on my machine from some .NET code that I am developing. I am currently using Application.Version , but it does not give me information about service packs.

I would rather avoid something like this: http://www.mvps.org/access/api/api0065.htm

Managed code is welcome!

+5
source share
4 answers
Public Shared Function GetExcelVersion() As Integer
    Dim excel As Object = Nothing
    Dim ver As Integer = 0
    Dim build As Integer
    Try
        excel = CreateObject("Excel.Application")
        ver = excel.Version
        build = excel.Build
    Catch ex As Exception
        'Continue to finally sttmt
    Finally
        Try
            Marshal.ReleaseComObject(excel)
        Catch
        End Try
        GC.Collect()
    End Try
    Return ver
End Function

Returns 0 if excel is not found.

+6
source

, . Microsoft ( , ).

, , .

+2

, , .

Keep in mind that you do not need to verify exact compliance. You can use single-value comparisons to see if you have a version, such as SP1 or newer. you know this is newer if the version number is greater than or equal to "11.0.6355.0" (you need to implement the comparison)

0
source

All Articles