Free Web Site - Free Web Space and Site Hosting - Web Hosting - Internet Store and Ecommerce Solution Provider - High Speed Internet
Search the Web

What version of Microsoft Excel

VB Tips:  Application and System


   lots of other programs need to know what version of Microsoft Excel is installed on the computer.

   TestExcelVersion

   The routine is called TestExcelVersion, and returns the version of Excel installed on the computer.

 

Public Function TestExcelVersion() as Integer
Dim wrkString As String
Dim wrkString2 As String
Dim wrkPos As Integer
Dim wrkExcelVersion As Integer
'
' Set Error Return
TestExcelVersion = 0
On Error GoTo TestExcelVersion_Error
'
' Get Registration Name for Excel Worksheet (.xls File)
wrkString = DZGetRegString(".xls")
if (wrkString = "") Then Exit Function
'
' Locate Last Dot in Registration Name
wrkPos = JMStringLastDot(wrkString)
'
' Identify Excel Version
wrkExcelVersion = Val(Mid$(wrkString, wrkPos + 1, 1))
if (wrkExcelVersion <= 0) Then Exit Function
'
' Get Excel Program Name
DZLoadProgram "xls", wrkString, wrkString2
'
' Test that the Program Name is returned
If (wrkString = "" Or wrkString2 = "") Then Exit Function
'
' Return the Excel Version
TestExcelVersion = wrkExcelVersion
End Function

   Note : A valid version of Excel will return something like Excel.Sheet.8, when the routine DZGetRegString tests the Windows Registry with .xls. Note that 8 identifies Excel 97.


Copyright (c) 1999 - 2001, robert han, all rigths are reserved.