How to call Adinterp in VBA code

Hi tried to write a user-defined function which uses AdInterp function.

An error occurred when I tried to load the AdfinXanalystics module with the below code:

Set CreateAdxUtilityModule = CreateReutersObject("AdfinXAnalyticsFunctions.AdxUtilityModule")

The error message is "File not found: PLVbaApis.dll"

Please kindly help. Thanks!

Answers

  • A few questions:

    1. Are you running this code in Eikon Excel?
    2. If yes, is Eikon Excel signed in to the platform?
    3. Could you show me your CreateReutersObject function declaration please?
  • Function InterpCGB(yr As Integer) As Double

    Dim r As Long
    r = ActiveCell.Row
    Dim y As Double

    Dim ws As Worksheet

    Set ws = ActiveSheet

    Dim ZcDates As Variant
    Dim ZcRates As Variant

    ZcDates = Array(1, 3, 5, 7, 10)
    ZcRates = Array(ws.Cells(r, 2).Value, ws.Cells(r, 4).Value, ws.Cells(r, 6).Value, ws.Cells(r, 8).Value, ws.Cells(r, 10).Value)


    'Set CreateAdxUtilityModule = CreateReutersObject("AdfinXAnalyticsFunctions.AdxUtilityModule")

    y = CreateAdxUtilityModule.AdInterp(yr, ZcDates, ZcRates, "IM:CUBR")

    InterpCGB = y


    End Function


    Sub test()
    MsgBox InterpCGB(Range("K4").Value)
    End Sub

  • Hi Zhenya I posted my code above. For your questions:

    1) yes

    2) yes

    3)

    #If VBA7 Then
    Public Declare PtrSafe Function CreateReutersObject Lib "PLVbaApis.dll" (ByVal progID As String) As Object
    #Else
    Public Declare Function CreateReutersObject Lib "PLVbaApis.dll" (ByVal progID As String) As Object
    #End If

    Public Function CreateAdxUtilityModule() As AdfinXAnalyticsFunctions.AdxUtilityModule
    Set CreateAdxUtilityModule = CreateReutersObject("AdfinXAnalyticsFunctions.AdxUtilityModule")
    End Function

    PS it worked on my colleague's PC.

    Thanks!

  • Hi @shelley.y.wang
    I don't see anything wrong with your code, which is further evidenced by it having worked on another machine. So, the issue you experienced must be machine specific. Let's start with a quick sanity check. You do have Eikon installed on this machine, right? If you search in the Eikon install folder you can find PLVbaApis.dll file, correct?
    Which version of Excel do you use? In particular I'm interested if it's 32-bit or 64-bit?

  • Hi

    1) Yes Eikon installed

    2) Yes PLVbaApis.dll exists in my active installation folder

    3) I'm running office 2007 so I'm assuming its 32bit. My PC system type is 64bit. The exact MS office version is 12.0.6612.1000

    Thanks

  • @shelley.y.wang what about if you try to build a Eikon Excel formula using the formula builder? Does it work?