我有一个使用Bloomberg API函数并使用宏循环输入的单元格,但我希望循环等待Bloomberg函数在继续之前产生结果(基本上是回调)。有没有直接的方法来实现这个目标?
答案 0 :(得分:0)
您可以尝试这样的事情:
Sub Main()
'Write API Formulas
Range("B1:C10000").Formula = "=bdp(""MSFT Equity"",""SECURITY_NAME"")"
'Check to see if it filled
Call Check_API
End Sub
Sub Check_API()
If Application.WorksheetFunction.CountIfs(Range("B1:C10000"), "#N/A Requesting Data...") > 0 Then
'Check every 3 seconds
Application.OnTime Now + TimeValue("00:00:03"), "Check_API"
Else
'Do what you want after api has loaded
MsgBox "Done"
End If
End Sub