vba - 在 vba 中使用 Bloomberg API

标签 vba excel bloomberg

我正在尝试使用此函数通过 Bloomberg API 加载数据-

' Make certain you have a Reference to C:\blp\API\ActiveX\blpdatax.dll
Sub FindBloombergData()
On Error GoTo Handler:

Dim oBlp As BLP_DATA_CTRLLib.BlpData
Dim ReqSecurities As Variant
Dim ReqFields As Variant
Dim vtResult As Variant
Dim n As Integer

Set oBlp = New BlpData
ReqSecurities = Array("SX5E Index")

ReqFields = Array("OPT_CHAIN")

With oBlp
.SubscriptionMode = ByRequest
.Subscribe ReqSecurities, 3, ReqFields, , , vtResult
End With

Stop 'and look at the results in Local or Watch Window
For n = 0 To UBound(vtResult(0, 0), 1)
Debug.Print n, vtResult(0, 0)(n, 0)
Next

Handler:
If Err.Number <> 0 Then
MsgBox Err.Description, vbCritical
End If

Set oBlp = Nothing
End Sub

但是,每当我尝试运行它时,我都会收到此错误:“编译错误用户定义的类型未定义”我做错了什么?它用以下代码突出显示了该代码行:Dim oBlp As BLP_DATA_CTRLLib.BlpData 但我肯定安装了 Bloomberg API

最佳答案

我刚刚遇到了同样的问题。原因很简单。旧代码已于 2011 年被弃用,彭博社不再支持它。该代码需要转换为 Bloomberg 的 COM V3 服务。

关于vba - 在 vba 中使用 Bloomberg API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8729738/

相关文章:

string - VBA 字符串是不可变的吗?

python - 如何在轴的顶部水平显示 xlsxwriter 柱形图的 y_axis 名称?

python - 如何将用 Pandas 提取的一列excel数据中的NaN替换为0

python - pdblp 中 bdh() 的字段覆盖

excel - 从 Excel VBA 调用 Bloomberg BQL 查询

VBA Word "insertsymbol"数学符号高值 unicode 失败

VBA DO 循环问题

excel - 电子邮件 Excel 范围 : Range to HTML with Hyperlinks

c# - 如何在 Excel 中获取选定的工作表名称

c# - 查找上次打开的 Bloomberg 窗口的索引