ExcelGetVersion As String

 

Returns CFBundleVersion of Microsoft Excel as a String.

 

Use this function do determine whether the required version of Excel is installed.

When Excel is not found on the current computer, then an empty String is returned.

If an error occurred, then "ERROR" is returned.

 

Example for a returned String:

14.4.7

 

 

Returns:

 

Type

Value

Description

String

empty String

Microsoft Excel was not found on the computer

String

ERROR

In case of any error the string "ERROR" is returned

String

14.4.7

When Excel was found, then the CFBUNDLEVERSION is returned as a String, for example: "14.4.7"

 

Available in:

 

WindowMain

WindowLink

YES

YES

 

  

Hint: You can find references to XojoScripts which make use of this function by sending the following SQL statement to the database:

Select id,GUID, ScriptName,ScriptCode from im_scripts where ScriptCode Like '%ExcelGetVersion%'

 

Example XojoScript:

 

// Check if we have Excel Installed

Dim v As String = ExcelGetVersion

If v = "" Or v = "ERROR" Then

MsgBox "Microsoft Excel is not installed!"

Return

End If

 

Dim ver As Integer = Val(Left(v,Instr(v,".")-1))

 

If ver < 14 Then

MsgBox "Microsoft Excel 2011 or newer is required!"

Return

End If

 

MsgBox "CFBundleVersion : " + v + EOL + "Major version : " + Str(ver)