title: How to use LibreOffice functions into Basic?
body: <p>I've <a href="https://stackoverflow.com/questions/30195024/good-usage-of-native-functions-in-libreoffice-basic">asked here</a> about the good way to do so.</p>
  
  <p>Now I'm trying the following code <a href="http://www.oooforum.org/forum/viewtopic.phtml?p=54844&amp;sid=03c9fbf9ce8e684bd1bccff488d38a09#54844" rel="nofollow noreferrer">found here</a>, and get some unexpected errors.</p>
  
  <p>I suppose I'm not using it the correct way. Any idea ?</p>
  
  <pre><code>Sub Main 
      Dim aResult 
      Dim aFunc 
      Dim oRange 
  
      aFunc = GetProcessServiceManager().createInstance("com.sun.star.sheet.FunctionAccess") 
  
      aResult = aFunc.callFunction("SUM", Array(1, 2, 3))
      ' ---- Works OK
      Print aResult 
  
      aResult = aFunc.callFunction("MDETERM", Array(2, 5, 8)) 
      ' ---- IllegalArgumentException
      Print aResult 
  
      oRange = ThisComponent.sheets(0).getcellrangebyname("B4:B6") 
      aResult = aFunc.callFunction("ZTEST", Array(oRange, 2.5, 1.0)) 
      ' ---- IllegalArgumentException
      Print aResult 
  End Sub
  </code></pre>