Kjell said:
I am, but in order to get the picture complete I would like to know
if a service pack is intalled or not.
My Excel reports a higher build number than the obj.build function
suggested by Karl, so I think this comes from an installed service
pack, I have SP3 installed.
Is there a way to detect an installed service pack? (for office)
Looks like Jonathan pointed you toward a good lookup table, once you have the actual
file version info. Here's how (on reflection) I might suggest you get at that, given
the confusion (and overhead!) with Automation.
First, find the actual Excel.exe file (you may need to create a temporary file, with
the proper extension, if you don't have an existing one handy):
Private Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA"
(ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As
Long
Private Const MAX_PATH As Long = 260
Public Function FindDocAssociation(ByVal FileName As String) As String
Dim Buffer As String
Dim nRet As Long
' Prepare buffer, and query operating system.
Buffer = Space$(MAX_PATH)
nRet = FindExecutable(FileName, vbNullString, Buffer)
If nRet < 0 Or nRet > 32 Then 'account for potential negative instance handles
' Return results. If an executable was passed as input,
' this will be identical. Must be actual document file.
FindDocAssociation = Left$(Buffer, InStr(Buffer, vbNullChar) - 1)
End If
End Function
Now, use CFileVersionInfo from
http://vb.mvps.org/samples/FileInfo to obtain the
actual version information from the currently associated executable. This will be
nearly instantaneous, in comparison to creating an Application object and querying
its properties.
Later... Karl