title: Visual Basic runtime error 1004
body: <p>I am trying to write a Visual Basic Script to run by windows task scheduler. The script is supposed to open a delimited text file into excel and then save it as an .xlsx file.</p>
  
  <pre><code>Function ImportText()
  
  Path = "C:\Users\username\Documents\"
  inFile = "2014_1_31_data_parse.txt"
  outFile = "2014_1_31_data_parse.xlsx"
  
  Set objExcel = CreateObject("Excel.Application")
  objExcel.Workbooks.OpenText FileName:=Path &amp; inFile, Other:=True, OtherChar:="^"
  
  objExcel.ActiveWorkbook.SaveAs FileName:=Path &amp; outFile
  
  objExcel.Quit
  WScript.Quit
  WScript.Echo "Completed"
  
  End Function
  </code></pre>
  
  <p>Currently it gives a Run-time error of 1004 file can not be found. However the file is there.</p>