title: I'm trying to import a daily filename_YYYYMMDD from a directory, but cannot get the VBA codes to import the file as a text file into Excel
body: <pre><code>Sub Macro1()
  
      Dim fs, f As Object
  
      Dim strPath As String
      strPath = "Filename_" + Format(Date, "yyyymmdd")
      Set fs = CreateObject("Scripting.FileSystemObject")
      Set f = fs.OpenTextFile(strPath, 1, 0)
  
      With ActiveSheet.QueryTables.Add(Connection:= _
      "TEXT;strPath", Destination:= _
      Range("A1"))
  
  End Sub
  </code></pre>
  
  <p>'-----I'm not sure what I'm missing above in VBA, but obviously, it works when I point to the filename manually in the macro set-up-----------------------------</p>
  
  <pre><code>Sub Macro1()
  
      With ActiveSheet.QueryTables.Add(Connection:= _
      "TEXT;C:\Desktop\filename_20140101.txt", Destination:= _
      Range("A1"))
  
  End Sub
  </code></pre>
  
  <p>' THANKS!!!!</p>