title: How to return a long string from a VBA function in Excel?
body: <p>I've the following function defined in Excel:</p>
  
  <pre><code>Function LongString()
      Dim i As Integer
  
      Do
          LongString = LongString &amp; "X"
          i = i + 1
      Loop Until i &gt; 40000
  
  End Function
  </code></pre>
  
  <p>This results in an error : <strong>#VALUE!</strong></p>
  
  <p>It seems that the maximum string length is limited to 32768 ?</p>
  
  <p>How to get this working ?</p>
  
  <p><strong>--EDIT--</strong>
  Thanks you all for your support. My solution was to split up my function into several cell which contain less then the 32768 characters.</p>