Using COM API in VBA code, suddenly cannot connect to Eikon Desktop
we are using COM API in the access VBA code to connect to Eikon Desktop, it worked very fine until one day it shows connection failed.
I have attached the VBA code. Since the code works before and if we switch the computer login profile to another user the code also works, we don't think it is the code has the problem.
So we suspect that the profile we used to login the computer has problem, but I am not sure where the problem could be.
Then we switched the profile and try to run the program. After a while, I got the error "ActiveX cannot create object" which indicates that it could not initialize the Eikon (no Eikon login page initialized). So I reinstall the Eikon on the computer under the new profile. Then we encountered the same problem again: cannot connect to Eikon desktop. Then we realized this might not related to profile used on the computer. We tried new version Eikon and old version Eikon and neither worked.
I just wonder if this issue related to Eikon itself, like reference or installation problem or it associated with the computer system, like firewall or registration key.
Sub Start()
If oEikonConnection Is Nothing Then Set oEikonConnection = New EikonDesktopDataAPILib.EikonDesktopDataAPI
oEikonConnection.Initialize
End If
Do Until oEikonConnection.Status
DoEvents
Loop
RequestData =>start to request data after connection
Set oEikonConnection = Nothing
End Sub
Best Answer
-
Calling DoEvents is no guarantee that the property of in-proc
COM server will be updated. VBA is single threaded and EikonDesktopDataAPI COM
object runs on the same thread as your loop. DoEvents should in theory yield
the execution to allow events to be processed, but you cannot rely on it. I’ve
seen it producing sporadic results in tests run one right after another on the
same machine with the same code. Sometimes it works and sometimes it doesn’t.
To have reliable behavior, instead of sitting in an endless loop
waiting for the Status property to change, use OnStatusChanged event provided
by EikonDesktopDataAPI COM object.0
Answers
-
Hi Alex, I actually tried using OnStatusChanged in the code. However this didn't work because the application did not even connect to Eikon, the initialization failed, so the code will never hit OnStatusChanged function or continue with other parts of the code.
0 -
When you added the event handler for OnStatusChanged event, did you remove the endless loop and the destroying of EikonDesktopDataAPI object from your Start procedure? The following code should be deleted from Start procedure:
Do Until oEikonConnection.Status
DoEvents
Loop
RequestData =>start to request data after connection
Set oEikonConnection = NothingThe call to RequestData procedure should be moved to OnStatusChanged event handler.
0 -
Yes, I tried to use the VBA code posted on the developer site. However the initialization status always shows a fail. I also have a c# app to connect to Eikon and it always give me disconnected status. And every time I download a new Eikon installer it always showed Download failed so I cannot continue to install the program
0 -
Since the issue is machine or user specific, dealing with it on the
forum would not be effective. We need to troubleshoot the problem on the
machine where the issue is reproduced. I'll reach out to you offline to schedule a troubleshooting session.0
Categories
- All Categories
- 6 AHS
- 39 Alpha
- 162 App Studio
- 4 Block Chain
- 5 Bot Platform
- 17 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 370 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 60 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛