calling qlInterpolation from vba

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

calling qlInterpolation from vba

Stephan Buschmann-2

Dear ql-users,
I allready checked the documentation about calling ql functions from vba (http://quantlib.org/quantlibxl/faq.html#faq_item_vba).
But unfortunately I cannot transfere this code to another example.

I would like to do some interpolation in vba using qlInterpolation:

The following code doesnt work:

Sub qlInterp()
   
    Dim xArray() As Double
    Dim yArray() As Double
    Dim i As Integer
   
    ReDim xArray(1 To 5)
    ReDim yArray(1 To 5)
   
    For i = 1 To 5
        xArray(i) = i: yArray(i) = i
    Next i
   
    Dim interpolationObj  As Variant
    interpolationObj = Application.Run("qlInterpolation", "", "Linear", xArray, yArray)
   
    Debug.Print interpolationObj
End Sub


Does the type cast to variant makes some trouble, or the arguments passed to the function?
But at the end  the GenericInterp object isnt created. The function works perfectly in Excel and returns the wanted object.

Can anyone give me a hint?


Thanks!
Stephan

------------------------------------------------------------------------------------------------------------------------------------------------------
WGZ BANK AG Westdeutsche Genossenschafts-Zentralbank
Sitz: Düsseldorf, Registergericht: Amtsgericht Düsseldorf, HRB 52363
Vorstand: Werner Böhnke (Vors.), Uwe Berghaus, Dr. Christian Brauckmann,
Karl-Heinz Moll, Michael Speth, Hans-Bernd Wolberg
Vorsitzender des Aufsichtsrats: Dieter Philipp

Ueber das Internet versandte E-Mails koennen unter fremdem Namen erstellt
oder inhaltlich veraendert werden. Aus diesem Grund sind unsere als E-Mail
verschickten Nachrichten grundsaetzlich keine rechtsverbindlichen
Erklaerungen. Der Inhalt dieser E-Mail samt Anlagen ist vertraulich und u.
U. rechtlich geschuetzt. Der Inhalt ist ausschließlich an einen bestimmten
Empfaenger gerichtet. Eine Weitergabe, die Herstellung von Kopien oder der
sonstige Gebrauch durch Nichtadressaten ist nicht erlaubt.

Messages sent by e-mail can be manipulated by third parties. For this
reason our e-mail messages are generally not legally binding. This
electronic message (including any attachments) contains confidential
information and may be privileged or otherwise protected from disclosure.
The information is intended to be for the use of the intended addressee
only. Please be aware that any copy, distribution or use of the contents of
this message by any other person than the intended addressee is prohibited.

------------------------------------------------------------------------------
Why Cloud-Based Security and Archiving Make Sense
Osterman Research conducted this study that outlines how and why cloud
computing security and archiving is rapidly being adopted across the IT
space for its ease of implementation, lower cost, and increased
reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

smime.p7s (6K) Download Attachment