Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • Eikon COM /
avatar image
Question by dorian.garin · Feb 12, 2021 at 06:47 PM · eikoneikon-com-apivbadate

Type Mismatch VBA - DfAddPeriod

Hello,

I am trying to use DfAddPeriod in VBA :


Public Function CreateAdxDateModule() As AdfinXAnalyticsFunctions.AdxDateModule
    Set CreateAdxDateModule = CreateReutersObject("AdfinXAnalyticsFunctions.AdxDateModule")
End Function


CreateAdxDateModule.DfAddPeriod("FRA", "12/02/2021", "1M", "EMC:S")

But this does return a Type Mismatch error, what Am I doing Wrong ?
Kindly

People who like this

0 Show 0
Comment
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

1 Reply

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by Alex Putkov.1 · Feb 12, 2021 at 07:49 PM

Most likely you have a type mismatch in the assignment statement calling CreateAdxDateModule.DfAddPeriod("FRA", "12/02/2021", "1M", "EMC:S") expression. The above function returns a Variant(1 To 1, 1 To 2) array. How do you declare the variable you assign the result of CreateAdxDateModule.DfAddPeriod("FRA", "12/02/2021", "1M", "EMC:S") to? In other words in the statement below how do you declare the variable named "res"?

res = CreateAdxDateModule.DfAddPeriod("FRA", "12/02/2021", "1M", "EMC:S")

On a side note, rather than creating a public function that returns AdxDateModule object (which in your example is named CreateAdxDateModule), I would suggest declaring a variable at the module level to store an instance of AdxDateModule class. This way you only need to have one instance of this class, which you can access any time you need to call a method like DfAddPeriod, rather than creating a new instance of AdxDateModule every time you execute DfAddPeriod method. E.g.

Dim m_AdxDateModule As AdfinXAnalyticsFunctions.AdxDateModule
Private Declare Function CreateReutersObject Lib "PLVbaApis.dll" (ByVal progID As String) As Object

Sub Test()
Dim res As Variant
If m_AdxDateModule Is Nothing Then Set m_AdxDateModule = CreateReutersObject("AdfinXAnalyticsFunctions.AdxDateModule")
res = m_AdxDateModule.DfAddPeriod("FRA", "12/02/2021", "1M", "EMC:S")
Debug.Print res(1, 1) & ", " & res(1, 2)
End Sub
Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

Watch this question

Add to watch list
Add to your watch list to receive emailed updates for this question. Too many emails? Change your settings >
10 People are following this question.

Related Questions

Using COM API in VBA code, suddenly cannot connect to Eikon Desktop

Can we download un-adjusted stock price under DEX2 COM API

VBA - Run and update TR Eikon data

Why doesn't Application.Run("RtGet","IDN",RIC,FID) work in Eikon for Excel VBA?

EikonDDA = New EikonDesktopDataAPI [object does not support this property or method]

  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Electronic Trading
    • Generic FIX
    • Local Bank Node API
    • Trading API
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • FX Venues
    • FX Trading – RFQ Maker
  • Intelligent Tagging
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open Calais
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • RDMS
  • Refinitiv Data Platform
    • Refinitiv Data Platform Libraries
  • Rose's Space
  • Screening
    • Qual-ID API
    • Screening Deployed
    • Screening Online
    • World-Check One
    • World-Check One Zero Footprint
  • Side by Side Integration API
  • TR Knowledge Graph
  • TREP APIs
    • CAT
    • DACS Station
    • Open DACS
    • RFA
    • UPA
  • TREP Infrastructure
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • Workspace SDK
    • Element Framework
    • Grid
  • World-Check Data File
  • Yield Book Analytics
  • 中文论坛
  • Explore
  • Tags
  • Questions
  • Badges