Excel VBA 调用彭博终端并输入查询,如何在代码中正确输入证券的黄键/市场板块?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17950868/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 22:29:24  来源:igfitidea点击:

Excel VBA calls Bloomberg terminal and enters a query, how do I enter the Yellow Key/ Market Sector of a security correctly in my code?

excelapivbabloomberg

提问by dedalus_rex

Hi I'm doing something in Excel vba that when I click the button that runs the macro it enters a query in Bloomberg and brings me to a security and a function that views it.

嗨,我正在 Excel vba 中做一些事情,当我单击运行宏的按钮时,它会在 Bloomberg 中输入一个查询,并将我带到一个证券和一个查看它的函数。

Blp = DDEInitiate("Winblp", "bbk")
Call DDEExecute(Blp, "<Blp-1>" & "APPL US Equity" & " DES<GO>")
Call DDETerminate(ch)

Now the problem is that this query goes into Bloomberg it never detects it as a valid security. I think this is definitely a yellow button issue, i.e. if you just type APPL US Equity into Bloomberg as opposed to APPL US [Equity] with yellow button it just wont work.

现在的问题是,这个查询进入彭博社,它从未将其检测为有效的证券。我认为这绝对是一个黄色按钮的问题,即如果你只是在彭博社中输入 APPL US Equity 而不是带有黄色按钮的 APPL US [Equity],它就不会起作用。

Is there a special object or string that I need to enter to have this query go in correctly? I've tried to search Google but can't find anything.

是否有我需要输入的特殊对象或字符串才能正确输入此查询?我试图搜索谷歌,但找不到任何东西。

Thanks

谢谢

采纳答案by assylias

Equityis a reserved keyword like Go, you can access it with:

Equity是一个保留关键字,如Go,您可以通过以下方式访问它:

Blp = DDEInitiate("Winblp", "bbk")
Call DDEExecute(Blp, "<Blp-1>" & "AAPL US <EQUITY>" & " DES<GO>")
Call DDETerminate(Blp)

ps: two typos in your code:

ps:你的代码中有两个错别字:

  • APPL => AAPL (I suppose)
  • DDETerminate(ch)=> DDETerminate(Blp).
  • APPL => AAPL(我想)
  • DDETerminate(ch)=> DDETerminate(Blp)