title: Recursive VBA function not returning properly
body: <p>Using this simple test below to a recursive function to understand why the function is not returning the expected value properly. here is the calling routine.</p>
  
  <pre><code>Public Sub TestRecursive()
     m_count = 0
     Debug.Print Recursive
  End Sub
  </code></pre>
  
  <p>Here is the recursive function.</p>
  
  <pre><code>Private Function Recursive() As String
    Recursive = "start"
    m_count = m_count + 1
    If m_count &lt; 5 Then
  
      'Debug.Print "counting " &amp; CStr(m_count)
      Recursive
    Else
  
      'Debug.Print "ended count "
      Recursive = "ended"
      Exit Function
    End If
    'Debug.Print "should never reach here"
  End Function
  </code></pre>
  
  <p>Not sure what is going on but the function recursive returns "start" instead of "ended". Any idea or suggestion what is going on?</p>