title: return value to vba from xlwings
body: <p>Let's use the example on <a href="http://docs.xlwings.org/vba.html" rel="nofollow">xlwings documentation</a>.</p>
  
  <p>Given the following python code:</p>
  
  <pre><code>import numpy as np
  from xlwings import Workbook, Range
  
  def rand_numbers():
      """ produces std. normally distributed random numbers with shape (n,n)"""
      wb = Workbook.caller()  # Creates a reference to the calling Excel file
      n = int(Range('Sheet1', 'B1').value)  # Write desired dimensions into Cell B1
      rand_num = np.random.randn(n, n)
      Range('Sheet1', 'C3').value = rand_num
  </code></pre>
  
  <p>This is the original example.</p>
  
  <p>Let's say we modify it slightly to be:</p>
  
  <pre><code>import numpy as np
  from xlwings import Workbook, Range
  
  def rand_numbers():
      """ produces std. normally distributed random numbers with shape (n,n)"""
      wb = Workbook.caller()  # Creates a reference to the calling Excel file
      n = int(Range('Sheet1', 'B1').value)  # Write desired dimensions into Cell B1
      rand_num = np.random.randn(n, n)
      return rand_num #modified line
  </code></pre>
  
  <p>And we call it from VBA using the following call:</p>
  
  <pre><code>Sub MyMacro()
      dim z 'new line'
      z = RunPython ("import mymodule; mymodule.rand_numbers()")
  End Sub
  </code></pre>
  
  <p>We get <code>z</code> as an empty value.</p>
  
  <p>Is there any way to return a value to vba directly without writing to a text file, or putting the value first in the excel document?</p>
  
  <p>Thank you for any pointers.</p>