I need to be able to detect which version of Excel I have installed in my machine from some .NET code I'm developing. I'm currently using Application.Version for that, but it doesn't give me information about Service Packs.
I would preferably to steer away from something like this: http://www.mvps.org/access/api/api0065.htm
Managed code welcomed!
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 not found.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With