4
我想使用这个功能 -使用在VBA彭博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
但是加载与彭博API数据,每当我尝试运行它,我得到这个错误:“编译错误的用户定义类型没有定义“我做错了什么?它突出显示了这段代码的代码行:Dim oBlp As BLP_DATA_CTRLLib.BlpData
但我绝对已经安装了bloomberg API
*确定你有一个参考... *你做了这个?工具 - >参考资料,找到彭博资讯库并勾选它。 – 2012-01-04 15:56:36
我有一个参考,仍然是相同的问题 – ecbtln 2012-01-05 16:10:26
检查对象浏览器(F2)的BLP_DATA_CTRLLib和它的BlpData,它们是否存在? – 2012-01-05 16:19:19