Using the Excel XIRR function in

Excel , , VS 2005 United Kingdom
  • 11 years ago

    I have created a reference to Excel in my VB code and can access the 'worksheetfunction' where the Xirr function is supposed to be. I know that in Excel it is necessary to add the 'Analysis Toolpak' to the Add-ins before being able to use the XIRR(). Does anyone know how this can be done in VB?

  • 11 years ago

    Hi dude...

    I am not sure if my answer will be useful because I am not good in automation ... however this is what I do and it works perfectly fine with Word, or Excel.

    In Excel start recording a Macro, and perform the operation you are willing to do in your program. After that go to Excel's vb editor, and copy the code.

    Next just past the code into your program, and place excel's object name in front of every command. You might need the value of some constants, for these you will have to get them from Excel... I think you can use F2 and search for the values in the code editor of Excel.

    Hope this helps.

    Best regards.

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Memory is like an orgasm. It's a lot better if you don't have to fake it.” - Seymour Cray