XLL+ Class Library (7.0)

What are value lists?

Frequently an argument must have a value that is a member of a list; very often such a value range is defined as an enum in C++. It is useful to be able to validate an input of this kind before it is used. An informative error message can be returned, to make it easy for the user to correct the value:

#VALUE! Expected one of 0,1,2,3,4,5,6 for DayCount

You can use the XLL+ Function Wizard to generate code for this validation. In the Argument dialog, for integer types, a Value List appears. You can use the page to create a list of acceptable values.

If you tick the box List is Exclusive, then code will be generated to validate the input DayCount; if the value does not match any of the entries in the Values column, then an exception is raised, and an error message is returned to Excel.

There are other benefits to using a Value List. If you tick the box Show list in Formula Wizard, then a drop-down list will appear in the the Excel Formula Wizard, with the descriptions of each of the acceptable values:

This feature makes it much easier for users to quickly learn to use the add-in function.

Also, the list of values will be included in the on-line Help as a table.

Next: A value list example >>