title: syntax for passing user defined type variable to function in vba
body: <p>I have defined a Type:</p>
  
  <pre><code>Type JobData
      r_j As Integer
  End Type
  </code></pre>
  
  <p>I have a variable assigned as the Type JobData:</p>
  
  <pre><code>Dim job_data() As JobData
  </code></pre>
  
  <p>I wrote a function:</p>
  
  <pre><code>Function sumReady(a1 As JobData, a2 As Integer) As Integer
  sumReady = a1(0).r_j
  
  For j = 1 To job_ct
     sumReady = job_data(j).r_j + sumReady
  Next
  
  End Function
  </code></pre>
  
  <p>But when I try to call the function, I get a syntax error.</p>
  
  <pre><code>ActiveCell.Offset(0, 4).Value = sumReady(job_data().r_j, job_ct)
  </code></pre>
  
  <p>(job_ct is defined as an Integer)</p>
  
  <p>What am I doing wrong?  Thanks!</p>