问题
I am looking to develop an Excel-Bloomberg macro. The excel spreadsheet will be linked to a Bloomberg Add-In and of course, a Bloomberg Terminal. The objective of the macro is to have a list of securities in column A which we need to gather ‘company news’ for. The objective of this macro is to provide news as a source of backup for equities moving over a price tolerance. The Bloomberg <CN> Screen is desired. The macro needs to execute to the <CN> (company news) screen of each security listed in column A of the spreadsheet.
The objective for this macro would be to <GRAB> (export the screen, virtually print screening, and sending the <CN> screen via email) for any security in column A with a price change of 10% or greater.
For example and for the date of 10/23 the stock of company ‘Yelp’ went down -18%
The news on Bloomberg <CN> screen is as follows
http://tinypic.com/r/2qnqgci/8
"Yelp shares Plummet as Quarterly Forecast Misses Estimates"
How could I get this <CN> screen to pull through a VBA Macro? and perhaps how could I get the subsequent screen (after clicking on the #1 news story in the image)
http://tinypic.com/r/t6p6o6/8
The macro would look up the stock of YELP on Bloomberg by using the company's CUSIP
which is 985817105 Equity
A simple formula for reference
To get the last price for current day would be:
=BDH(985817105 Equity,PX_LAST,20141023) [all of those values would be cell references, Bloomberg Data History]
alternatively the =BDP formula could be used:
=BDP(985817105 Equity,PX_LAST) [this Bloomberg Data Point formula only captures current day data]
I have seen some Bloomberg code utilizing keyboard characters to navigate i.e. <tabr> & <GO> but I am not too familiar.
回答1:
Something like this.
bg = DDEInitiate("winblp", "bbk")
Call DDEExecute(bg, "<blp-3><home>ID " & bbgkey & "<GO>")
Call DDEExecute(bg, "<blp-3>CN<GO><copy>")
ThisWorkbook.Worksheets("Main").Range("A1").PasteSpecial
来源:https://stackoverflow.com/questions/26538783/bloomberg-excel-vba-macro-to-email-bloomberg-cn-screen-via-grab