How to use Bloomberg Data History (BDH) command within Microsoft Visual Basic (VBA for Excel)

╄→尐↘猪︶ㄣ 提交于 2019-12-06 01:19:51

You have to escape the quotes with more quotes. It also doesn't hurt to set the formula property instead of setting the value, but it isn't necessary for this to work. It's the quotes that are causing the compiler error.

Range("B16").Formula = "=BDH(""TSLA"", ""PX_LAST"", ""01/01/2014"", ""01/03/2014"", ""Period, Dates"", ""M,H"")"

The syntax I found has the optional settings at the end being set as "Setting=x, OtherSetting=y" which would be how my formula below is set up:

Range("B16").Formula = "=BDH(""TSLA"", ""PX_LAST"", ""01/01/2014"", ""01/03/2014"", ""Period=M, Dates=H"")"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!