Excel Bloomberg API回调宏 [英] Excel Bloomberg API callback in macro

查看:253
本文介绍了Excel Bloomberg API回调宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用彭博API函数的单元格,并使用宏循环输入,但是我希望循环等待Bloomberg函数在继续(基本上是回调)之前产生一个结果。有没有一个直截了当的方式来完成这个?

解决方案

你可以尝试这样的东西:

  Sub Main()

'写API公式
范围(B1:C10000)。Formula == bdp MSFT权益SECURITY_NAME)

'查看是否填写
调用Check_API

End Sub


Sub Check_API()

如果Application.WorksheetFunction.CountIfs(范围(B1:C10000),#N / A请求数据...)> 0然后
'每3秒检查一次
Application.OnTime Now + TimeValue(00:00:03),Check_API
Else
'在api之后做你想要的已经加载
MsgBoxDone
End If

End Sub


I have a cell utilizing a Bloomberg API function and looping through inputs using a macro, but I want the loop to wait for the Bloomberg function to produce a result before proceeding (basically a callback). Is there a straightforward way of accomplishing this?

解决方案

You can try something like this:

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

这篇关于Excel Bloomberg API回调宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆