!Bloomberg vba价格导入问题

时间:2018-05-01 14:51:27

标签: excel vba bloomberg

几个月来我一直在使用由同事完美创建的宏,但由于某种原因它在2天前停止了,我对编程有点不熟悉(请原谅我)但看起来好像发生了什么事用于提取数据的Bloomberg命令(列出的证券价格)

这是我收到的错误消息:

enter image description here

这是宏,直到它停止的行

Option Explicit
Option Base 1
Sub update()

Dim wbk As Workbook 'This workbook
Set wbk = ThisWorkbook
Dim path As String
path = wbk.path
Dim oBBG As New BLP_DATA_CTRLLib.BlpData
Dim date_string As String
date_string = CStr(CLng(Now()))

Dim row As Long
Dim col As Long
Dim vtSecurities As Variant
Dim vtFields As Variant
Dim vtData As Variant
Dim d1 As Date
Dim tmp As String

With wbk.Sheets(1)
        .Activate

        .Cells(1, 1) = "TICKER"
        .Cells(1, 2) = "LAST_PRICE"
        .Cells(1, 3) = "DESCRIPTION"
        .Cells(1, 4) = "CURRENCY"
        .Cells(1, 5) = "PRICE_CLOSE_DATE"
        .Cells(1, 6) = "LAST_UPDATE"
        .Cells(1, 7) = "PX_CLOSE_DT"
        d1 = Now()
        .Cells(1, 8) = "Last Refresh"
        .Cells(1, 9) = d1

        .Cells(5, 9) = "Macro Guideline"
        .Cells(6, 9) = "1- Copy Ticker in first column"
        .Cells(7, 9) = "2- Click on the update button"
        .Cells(8, 9) = "3- Ticker not found will be move into the Deleted Table. They will not appear in the Bloomberg Extract table."


        'Find the last non-blank cell in column A(1)
        row = .Cells(Rows.Count, 1).End(xlUp).row
        'Find the last non-blank cell in row 1
        col = .Cells(1, Columns.Count).End(xlToLeft).Column

        vtSecurities = WorksheetFunction.Transpose(.Range(Cells(2, 1), Cells(row, 1)))
        vtFields = Array("PX LAST", "Name", "CRNCY", "PX_LAST", "LAST_UPDATE_DT", "PX_CLOSE_DT")
        **vtData = oBBG.BLPSubscribe(vtSecurities, vtFields)**

如果遗漏了任何内容,我很抱歉,我已经过验证,Bloomberg数据类型库位于选中的参考文献中。

谢谢!

1 个答案:

答案 0 :(得分:0)

仅供参考,Bloomberg更新了他们的桌面API。所有旧的API调用都不起作用。您需要将代码更改为新的API,或者我被告知,如果您提出要求,Bloomberg可以将您的登录信息还原为旧API。

相关问题