title: Mismatched parenthesis
body: <p>I wrote a function for calc to split a cell before a word containing certain characters:</p>
  
  <pre><code>Function sidx(inputstr) As Integer
      Dim newString As String
      newString = ""
      Dim last_space_idx As String
      last_space_idx = 0
      Dim l As Integer
      'l = (inputstr.Length - 1) was ported from js on google sheets
      l = Len(inputstr) - 1
      For i = 0 To l
         If inputstr(i) = " " Then
              last_space_idx = i
         End If
         If ("’aeiou".Indexof( inputstr(i) ) &gt; 0) Then
              sidx = last_space_idx
         End If
      Next i
      sidx = last_space_idx
  End Function
  </code></pre>
  
  <p>for some reason libreoffice has trouble parsing this and complains about  mismatched parenthesis or missing Then at the last If statement. Any ideas?</p>