XLL+ Class Library (7.0)

Modifying an add-in function with the Wizard

It isn't always possible to get the function definition right the first time around. You may need to go back and change details of a function's specification. For example, you may want to:

The Function Wizard can do all of these tasks and many more. The Function Wizard can read the code that it generates, so that you can edit a definition you have previously created.

Adding another argument

Let's revisit our historical volatility calculator, and let the user specify the number of business days in a year. In our first implementation, we hard-coded this to 250.

Launch the Function Wizard

To fix the problem, we need to revisit the function definition using the Function Wizard. In Visual Studio, put the cursor somewhere in the body of the HISTVOL() function and click on the Tools/XLL+ Function Wizard tool.

Select HISTVOL

The Function Wizard will appear, with the HISTVOL function definition displayed. If another function is displayed instead, use the File/Select Function tool-button or menu to select HISTVOL, as shown below

You can now make any changes you need to the function and, when you press OK, the code in your source file will be regenerated.

Note: only code between the //{{XLP_SRC delimiters will be overwritten. Any code which you have added outside the delimiters will be unaffected.

Add a new argument

In the arguments grid, go to the Name column of the last line and type in the name of the argument, DaysPerYear.

Fill in the argument's columns as follows:

Name: DaysPerYear
Type: Double
Description: Number of samples per year

After you add the argument, the Function Wizard should look like this:

Click on the OK button to dismiss the Wizard and update the source code.

Next: Changes to the generated code >>