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 jingwersen · Feb 28, 2018 at 07:16 AM · eikoneikon-com-apivbarefreshsynchronous

Synchronous Refresh Methods for VBA in Excel

Hi there,

I am currently trying to implement a button that simply refreshes the data in my workbook and then exports a specific sheet as a PDF. Everything works fine except that the refresh does not finish until after the PDF is created. The link below seemed to be an answer but it still does not work:

https://community.developers.refinitiv.com/questions/20247/can-you-please-send-me-the-excel-vba-code-which-ex.html

The line

Application.Run "PLRefreshWorkbookEventHandler"

works properly for refreshing the workbook but it starts, gets interrupted by my code to export as a PDF, and then finishes. The article I linked states that

Application.Run "EikonRefreshWorkbook"

should be used if I wanted synchronous behaviour and for the refresh to finish before anything else occurs. However, when I use the button with this line, nothing happens. I thought maybe it was my version and that mine does not allow for the second type of refreshing but I am not sure how I can check.

Any help would be appreciated.

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.

2 Replies

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by Alex Putkov.1 · Feb 28, 2018 at 12:21 PM

I have to disagree with the answer by @Zhenya Kovalyov. EikonRefreshWorkbook macro is specifically designed to refresh all =TR functions in a workbook synchronously. The call NumFuncRefreshed = Application.Run("EikonRefreshWorkbook") returns the number of functions that have been refreshed when the call returns due to the job finished or due to timeout.
@jingwersen, it would be very helpful if you shared an example spreadsheet where running Application.Run("EikonRefreshWorkbook") has no effect. Or at least share an example of worksheet function that doesn't get refreshed. Note that running EikonRefreshWorkbook macro has no effect on =TF functions.
EikonRefreshWorkbook macro is available in Eikon version 4.0.23 and higher. You can check the Product Version in Help - About available in Thomson Reuters ribbon, though I don't believe the version of Eikon is the issue here. If EikonRefreshWorkbook macro were not available on your machine I would expect Application.Run("EikonRefreshWorkbook") to produce VBA runtime error 1004: Cannot run macro 'EikonRefreshWorkbook'...

Comment
jingwersen

People who like this

1 Show 3 · 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.

avatar image
jingwersen · Mar 01, 2018 at 04:34 AM 0
Share

Thank you! Unfortunately I just started working on this excel software a couple days ago so I am not too familiar. I think my issue is that the function calls to refresh the data are not =TR. When I checked "Manage Requests" to see what my company was using to refresh data, it is a function called =DSGRID. I am assuming that "PLRefreshWorkbookEventHandler" can handle this but "EikonRefreshWorkbook" cannot. If it helps, the requests are of type TimeSeries. I apologise on my lack of knowledge, I only started interning and was assigned this project to make it easier to refresh with a button.

avatar image
REFINITIV
Alex Putkov.1 ♦♦ jingwersen · Mar 02, 2018 at 12:05 PM 0
Share

You're correct that "PLRefreshWorkbookEventHandler" can refresh =DSGRID functions while "EikonRefreshWorkbook" cannot. However in my experience =DSGRID functions are always refreshed synchronously. I created a test spreadsheet containing a handful of =DSGRID functions and ran the following code

Debug.Print VBA.Now
Application.Run "PLRefreshWorkbookEventHandler"
Debug.Print VBA.Now
I can see that the second timestamp print is several seconds after the first. I think I need more details of the original problem you're trying to solve, and ideally a way to reproduce it.
avatar image
REFINITIV
Alex Putkov.1 ♦♦ jingwersen · Mar 02, 2018 at 12:06 PM 0
Share

If you could post an example illustrating the issue, that would be most helpful.

avatar image
REFINITIV
Answer by Zhenya Kovalyov · Feb 28, 2018 at 08:32 AM

@jingwersen in my opinion, what you are trying to do is asynchronous by nature, so it is quite difficult to propose anything without looking at the file. But you can explore either of these:

  1. You can create a logical function, that will return True when all the data is updated on your spreadsheet, and monitor the value of this cell in Worksheet_change() event handler, then generate the pdf.
  2. Substitute you data delivery routine with COM API calls, such as DEX2, RHistory or AdfinX Real-time.
  3. Redesign the workflow to leverage the Python API;
  4. Optimize/chain your spreadsheet functions so, that the last function to be executed will call the pdf generation routine with the MACRO param of the TR function.(For example, =TR("EUR=","BID",{"UPDFRQ","2S";"MACRO","examplemacro.xlsm!Sheet1.SimpleMacro"},,)

I would go for 2 or 3, let me know if you require any further info.

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 >
7 People are following this question.

Related Questions

How to disable automatic TR data refresh in Excel?

Can I Control Eikon Excel AddIn for refresh a WorkSheet with VBA ??

Historical quarterly fundamentals with DEX2 - unexpected result

Performance issues when fetching large amounts of data

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

  • 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
  • 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
  • 中文论坛
  • Explore
  • Tags
  • Questions
  • Badges