title: How to use Bloomberg Data History (BDH) command within Microsoft Visual Basic (VBA for Excel)
body: <p>I would like to use a simple VBA script to call the Bloomberg BDH function in specific locations of my spreadsheet, which is computationally primitive.</p>
  
  <p>While the use of standard Excel functions doesn't see to be a problem, as soon as I insert the parts of the Bloomberg function that contain quotation marks (such as "Dates,Period", "H,M") I get an <em>expected end of statement</em> error.</p>
  
  <p>All I want to do is insert these function calls into specified cells. Unfortunately I have no experience with VBA and don't know why the quotation marks seem to mess it up.</p>
  
  <p>Is there an alternative for the =BDH function which doesn't use symbols that VBA doesn't like? Or is there any other way to insert a Bloomberg function into a specified cell using a marco?</p>
  
  <p>Any help would be greatly appreciated!</p>
  
  <p>Here's the exact code I am trying to use:</p>
  
  <pre><code>Range("B16").Value = "=BDH("TSLA", "PX_LAST", "01/01/2014", "01/03/2014", "Period, Dates", "M,H")"
  </code></pre>