XLL+ Class Library (6.3)

Quick start

After you have installed XLL+, follow these instructions for the quickest possible introduction to using XLL+. You can find out more about any of the steps by clicking on the "More..." links.

  1. Start Microsoft Visual Studio.

  2. Use the XLL+ AppWizard to create a new project of type XLL+ 6 Excel Add-in. Accept all the default choices in the Wizard's pages.

    More on AppWizard...

  3. Open the main (.cpp) source file and use the XLL+ Function Wizard item on the Tools menu to open the create a new add-in function.

    On the Tools menu, click the New XLL+ Function item and then fill in the function's name, and press OK.

    More on creating add-in functions...

  4. In the XLL+ Function Wizard, add the function's description and category, add the names, types and descriptions of your function's arguments, and press OK.

    More on the Function Wizard...

  5. In Visual Studio, add your own code to the skeleton generated by the Wizard, then build and test your project. The code below sets the result of the function to -999.9. As with all the example code in this guide, the code which the developer should add is shown in inverse.
    CopyC++
    CXlOper* HISTVOL_Impl(CXlOper& xloResult, const CXlOper* Prices_op, double 
        DaysPerYear)
    {
        // Input buffers 
        std::vector<double> Prices;
        // Validate and translate inputs
        XlReadVector(*Prices_op, Prices, L"Prices", XLA_TRUNC_ONEMPTY|
            XLA_TRUNC_ONBLANK);
        // End of generated code 
    //}}XLP_SRC 
     
        // TODO - set the value of xloResult, or return another value 
        //          using CXlOper::RetXXX() or throw a CXlRuntimeException. 
        xloResult = -999.9;
     
        return xloResult.Ret();
    }
    In a real-world example, you would now pass the inputs to a useful function, and return the result, or handle any errors. For example, you might add the try-catch block shown below:
    CopyC++
    CXlOper* HISTVOL_Impl(CXlOper& xloResult, const CXlOper* Prices_op, double 
        DaysPerYear)
    {
        // Input buffers 
        std::vector<double> Prices;
        // Validate and translate inputs
        XlReadVector(*Prices_op, Prices, L"Prices", XLA_TRUNC_ONEMPTY|
            XLA_TRUNC_ONBLANK);
        // End of generated code 
    //}}XLP_SRC 
     
        try                                                
        {                                                  
            xloResult = CalcHistVol(Prices, DaysPerYear);  
        }                                                  
        catch(...)                                         
        {                                                  
            xloResult = xlerrValue;                        
        }                                                  
     
        return xloResult.Ret();
    }

    More on coding add-in functions...

For a more thorough introduction to XLL+, read through the topics in the Getting Started section.

Next: Creating an add-in project >>