title: Importing Delimited File to Excel with Macro (.CommandType = 0)
body: <p>Lots of similar questions going on but google and stack overflow are not touching the part I think I need. I am trying to import a pipe delimited text file with a macro. When I record macro, this is what I get:</p>
  
  <pre><code>With ActiveSheet.QueryTables.Add(Connection:= _
      "TEXT;C:\Users\johnsmith\Desktop\Macro Tinkering\ABC_Financials_ALL(Delimited).txt" _
      , Destination:=Range("$A$1"))
      .CommandType = 0
      .Name = "ABC_Financials_ALL(Delimited)_1"
      .FieldNames = True
      .RowNumbers = False
      .FillAdjacentFormulas = False
      .PreserveFormatting = True
      .RefreshOnFileOpen = False
      .RefreshStyle = xlInsertDeleteCells
      .SavePassword = False
      .SaveData = True
      .AdjustColumnWidth = True
      .RefreshPeriod = 0
      .TextFilePromptOnRefresh = False
      .TextFilePlatform = 437
      .TextFileStartRow = 1
      .TextFileParseType = xlDelimited
      .TextFileTextQualifier = xlTextQualifierDoubleQuote
      .TextFileConsecutiveDelimiter = False
      .TextFileTabDelimiter = False
      .TextFileSemicolonDelimiter = False
      .TextFileCommaDelimiter = False
      .TextFileSpaceDelimiter = False
      .TextFileOtherDelimiter = "|"
      .TextFileColumnDataTypes = Array(2, 2, 2, 2, 2)
      .TextFileTrailingMinusNumbers = True
      .Refresh BackgroundQuery:=False
  End With
  </code></pre>
  
  <p>When I try to run the macro, it fails, and when I debug, it points me in the direction of ".CommandType = 0"</p>
  
  <p>Anyone know if there is a value that will get this macro going? Or are my problems worse than that?</p>