XLL+ Class Library (7.0)

XlFunction Element

This element represents a single Excel add-in function. The XlFunction element must contain the following required child element: Arguments. The XlFunction element may contain the following optional child element: Extensions. The XlFunction element may also contain an empty and attribute-less Enums element, which will be ignored. The XlFunction element has the following required attributes: ExportedName, Category. The XlFunction element has the following optional attributes: Availability, EntryPointXL4, EntryPointXL12, Flags, HelpId, ReturnType, Versions, Description, TemplateKey, ExportedNameAsync, ExportedNameQueued, ExportedNameSync. The following optional attributes are ignored: SourceFile, SourceLine, CategoryForLocale, CategoryUSEnglish, SafeName.

Attributes

ExportedName

Required. The name of the function as it will appear in Excel. This name should be unique within an add-in. If it is not, then the function will not be registered, and the code may not even compile. The XLL+ tools issue warnings when a duplicate function name is used. The ExportedName property controls the default values of several other properties, including EntryPointXL4, EntryPointXL12.

EntryPointXL4

By default the 'C' entry point for Excel 2003 and below is ExportedName followed by "_4". This value can be overridden by setting the EntryPointXL4 attribute. The default value for this attribute is empty.

EntryPointXL12

By default the 'C' entry point for Excel 2007 and above is ExportedName followed by "_12". This value can be overridden by setting the EntryPointXL12 attribute. The default value for this attribute is empty.

Category

Required. Category in which the function will appear within the Excel Formula Wizard. The standard built-in categories are stored as numbers between 1 and 14. See the XLL+ documentation for a list of category numbers.

Availability

The conditions under which the function will be available: from a worksheet cell, from a macro or hidden. Availability may have one of the following values: Hidden, Worksheet or Macro.

Versions

Controls which Excel versions the function will support explicitly. Versions may have one of the following values: Excel2003AndBelow indicates Excel 95 to Excel 2003; Excel2007AndAbove indicates Excel 2007 upwards; and AllExcelVersions indicates all Excel versions from Excel 95 upwards. This attribute controls the code that will be generated by XLL+. If Versions is set to AllExcelVersions then two wrapper functions will be generated, one for each environment, and the appropriate one will be registered, depending on which version of Excel is running. If only one environment is supported then only one wrapper function will be generated. If Excel2003AndBelow is used then the add-in will work in all versions of Excel, but will not take advantage of the new features of Excel 2007 and above. If Excel2007AndAbove is used, then the function will not be available in Excel 2003 and below.

Flags

The Flags attribute should contain either an integer or a series of space-separated strings. In either case the attribute can contain some or all of: ThreadSafe (1), HideInFormulaWizard (2), Volatile (8), DeferRecalc (16), CacheResults (64), CreateAsyncVersion (512), CreateQueuedVersion (1024).

HelpID

If a function has a non-zero help ID, then it will be used to resolve the help topic for the file when the user clicks "Help on this function". The default value for HelpId is zero.

Description

Description of the function which will appear within the Excel Formula Wizard. The default value for Description is empty.

ReturnType

The value will always be CXlOper for functions that return a variable type, or that return arrays, or that may fail. The default value for ReturnType is CXlOper. ReturnType may have any of the following values: Boolean, Double, Short, UShort, Int, CXlOper.

TemplateKey

Identifies the template used to generate the code of this function. The default value for TemplateKey is empty.

ExportedNameAsync

The Excel name used for the asynchronous version of the function. If omitted or blank, a default value will be used. (Ignored if CreateAsyncVersion is not specified.) The default value for the property is the empty string.

ExportedNameQueued

The Excel name used for the queued version of the function. If omitted or blank, a default value will be used. (Ignored if CreateQueuedVersion is not specified.) The default value for the property is the empty string.

ExportedNameSync

The Excel name used for the synchronous version of the function. If omitted or blank, a default value will be used. (Ignored if CreateAsyncVersion or CreateQueuedVersion are not specified.) The default value for the property is the empty string.

SourceFile

Ignored.

SourceLine

Ignored.

CategoryForLocale

Ignored.

CategoryUSEnglish

Ignored.

SafeName

Ignored.

Element Information

Number of occurrences

Unlimited

Parent elements

Functions  GeneratedFunction 

Child elements

Arguments  Extensions  Enums 

See Also

XLL+ Function Schema