How to update / download bloomberg RTD function (BDH) in excel in vba

I would like to know if there is a way in VBA code that forces bloomberg functions (in a spreadsheet) to update its value (any BDH functions)

Targeting Developers faced a similar problem / have Bloomberg terminal

What I tried -

Application.RTD.RefreshData Application.RTD.throttleInterval = 0 Application.CalculateFull 

The BDH function does not reload them.

The only way to update them now is to click on the "Update working document" button on the BloomBerg add-in ribbon.

Since the Bloomberg add-in is locked in VBE, I cannot find the code I need. Am I missing a link to Bloomberg? Can any Bloomberg expert / user point me in the right direction? Thank you

+6
source share
3 answers

I searched for the keyword "refresh" in xla, opening it in notepad. Found the following targets:

 RefreshAllWorkbooks blpmain.xla!RefreshAllStaticData blpmain.xla!'RefreshWorkbookFundamentalsData blp.xla!IsBlpRefreshAvailable 

I tried them one by one, the first 2 works, causing:

 Application.run "RefreshAllWorkbooks" Application.run "RefreshAllStaticData" 

But don't call them alone (I guess, because somehow I can call the protected PUBLIC procedure using Application.run)

 RefreshAllWorkbooks 

or

 RefreshAllStaticData 

thanks for the help

+6
source

I have never been able to do what you ask. The only reliable way I found to get relevant data is to call the API directly from VBA using BLP_DATA_CTRLLib.BlpData , wait for a response, and put the result in a sheet.

Regarding opening password protected VBA code, a google or stackoverflow search should give you an answer.

+1
source

I found that changing something in the BDH formula will result in an update. Find and replace the = sign would make a check mark.

 Public Sub Recalc() Dim ws As Worksheet, FormulaCells As Range, c As Range Application.Calculation = xlCalculationManual For Each ws In ThisWorkbook.Worksheets On Error Resume Next ws.Activate Set FormulaCells = ws.UsedRange.SpecialCells(xlCellTypeFormulas).Cells If Err = 0 Then For Each c In FormulaCells c.Formula = Replace(c.Formula, "=", "=") Next 'c Else Err.Clear End If Next 'ws Application.Calculation = xlCalculationAutomatic End Sub 
+1
source

Source: https://habr.com/ru/post/927555/


All Articles