question

Upvotes
Accepted
3 0 1 4

Cant call Adfin bond function 'BdCashFlows' from VBA

Hi, I am trying to call Adfin bond module function "BdCashFlows" from VBA. I can create a Bond module by calling "CreateAdxBondModule" however call to BdCashFlows fails with Object Required. I am also not able to reference adxfoo.dll in my project. It shows error while loading dll. Below is my VBA code snippet:

    Dim calcDate As Date
    Dim matDate As Date
    Dim nominalCouponRate As Double
    Dim bondStruct As String
    Dim bdMode As String
    
    
    'cashflow parameters
    
    calcDate = "15-Apr-2000"
    matDate = "01-Dec-2015"
    nominalCouponRate = 0.08
    bondStruct = "FRQ:1 RT:C"
    bdMode = "IAC RET:A16"
    
    
    Dim bm As Object
    Dim cf As Object
    
    'create bond module
    Set bm = CreateAdxBondModule()
    
    'call BdCashFlows
    Set cf = bm.BdCashflows(calcDate, matDate, nominalCouponRate, bondStruct, bdMode)
eikoneikon-com-apiexcelvba
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Where are you importing the dll from?

Hi Zhenya,

I have two binary folders under "C:\Program Files (x86)\Thomson Reuters". I tried importing it from Y & Z folders but all ends with a error.

Eikon\Y\Bin

Eikon\Z\Bin

1 Answer

Upvotes
Accepted
3 0 1 4

Hi @Zhenya Kovalyov

Thanks for looking into the query and webex session to resolve the issue. The issue was with explicit types (ex: Date) passed to Adfin BdCashFlows which expects them as variant type.

Secondly, the module type was set up as an object, it should be AdfinXAnalyticsFunctions.AdxBondModule

Corrected code

    Dim calcDate As Variant
    Dim matDate As Variant
    
    Dim nominalCouponRate As Double
    Dim bondStruct As String
    Dim bdMode As String


    Dim bm As AdfinXAnalyticsFunctions.AdxBondModule
    
    Set bm = CreateReutersObject("AdfinXAnalyticsFunctions.AdxBondModule")
    
    calcDate = DateValue("15-Apr-2000")
    matDate = DateValue("01-Dec-2015")
    nominalCouponRate = 0.08
    bondStruct = "FRQ:1 RT:C"
    bdMode = "IAC RET:A16"
    
    Dim res As Variant
    res = bm.BdCashflows(calcDate, matDate, nominalCouponRate, bondStruct, bdMode)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea