title: VBA Excel 2016 - Import text file - Unhandleable error when filelen < 2
body: <p>I have a big problem that I need to solve!
  I'm creating a workbook for people to open it on their machines so I must be sure that the code behaviors will be logical...</p>
  
  <p>I'm stucked with a weird case!
  I am trying to import a .csv file through a querytable. If that file contains less than 3 characters I get an "out of memory" (7) error that I can't handle with on error statement!!</p>
  
  <p>Here I create the queryTable :</p>
  
  <pre><code>Private Function CreateProductsQueryTable(ByRef ws As Worksheet) As QueryTable
  
  Set CreateProductsQueryTable = ws.QueryTables.Add("TEXT;" &amp; GetPath(ws.Parent) &amp; PRODUCTS_FILE_NAME, ws.range("A2"))
  
  With CreateProductsQueryTable
  
      .name = CONNECTION_NAME
      .RefreshStyle = xlOverwriteCells
      .TextFilePlatform = 1252
      .TextFileStartRow = 1
      .TextFileTabDelimiter = False
      .TextFileSemicolonDelimiter = True
      .AdjustColumnWidth = False
      .TextFileColumnDataTypes = Array(2, 2, 2, 1, 1, 1, 1, 1)
      .TextFileDecimalSeparator = ","
  End With
  End Function
  </code></pre>
  
  <p>No problems with that as you may check!</p>
  
  <p>An here I try to refresh it :</p>
  
  <pre><code>Private Function Refresh(ByRef qt As QueryTable) As Boolean
  
  With qt
  
          On Error GoTo emptyFile
          .Refresh True
          On Error GoTo 0
  
      If .ResultRange.Columns.count &lt;&gt; GetName(HEADERS_NAME, .Parent).RefersToRange.Columns.count Then
  
          .ResultRange = ""
          .Delete
      Else
  
          Refresh = True
      End If
  
      Exit Function
  
  emptyFile:
  
          .ResultRange = ""
          .Delete
      End With
  End Function
  </code></pre>
  
  <p>Despite the "on error goto emptyFile" statement I still get an "out of memory" error prompt highlighting the ".refresh" method, when my file contains 0, 1 or 2 characters..!! I just have to manually put a third character to get things work properly...
  I really need to know if this behavior is intended and if it would be the same on any machine! If so I would just control the filelen! But what if this is a weird bug that happens for a random filesize like if a user get that unhandled error while trying to refresh with a 4 characters long file..?? That would be a mess ^^'</p>