title: Like returning False for no obvious reason in VBA
body: <p>I am trying to write a data filtering script in VBA and thought that it would be a good idea to do so using a separate function. Hence, I got the following code:</p>
  
  <pre><code>Sub checkFormat()
  Dim cont As String
  cont = "21-345"
  cont = funkcja(cont)
  check = cont Like "##-###"
  
  Debug.Print check &amp; " vartype: " &amp; VarType(cont)
  
  End Sub
  
  Private Function funkcja(Param1 As String)
  If ((Left(Param1, 1) = " ") Or (Right(Param1, 1) = " ")) Then
      Param1 = Trim(Param1)
      Debug.Print "Cut"
  Else
      Debug.Print "Nothing to cut"
  End If
  Debug.Print "Returned: """ &amp; Param1 &amp; """" &amp; " vartype: " &amp; VarType(Param1)
  End Function
  </code></pre>
  
  <p>The problem is that <code>check</code> variable returns False no matter whatever value I assign to it. However, once I comment out the <code>cont=funkcja(cont)</code> line, Like function begins to work as it should. Could anyone tell me what <code>funkcja</code> function does to the string so that Like returns False? I checked for variable type, but it's always set to String...</p>