title: Using Yield Function in VBA
body: <p>I want to calculate the Yield To Maturity of a bond using Yield().  Yield() is available in the excel workbook, but I cannot find this function in VBA.  </p>
  
  <p>It is not an available WorksheetFunction, nor does it appear as a function in the [atpvbaen.xls] reference.  Does anyone have any suggestions or experience with trying to use Yield() in VBA?  </p>
  
  <p>I have tried the following without success: </p>
  
  <pre><code>   Dim s as Double
     s = [Yield(settle, maturity, coupon, price, 100,2,1)]
  </code></pre>
  
  <p>The compiler gives me a type mismatch error. </p>
  
  <p>When using:</p>
  
  <pre><code>    Debug.Print [Yield(settle, maturity, coupon, price, 100,2,1)]
  </code></pre>
  
  <p>The immediate window shows Error 2029</p>