title: Code 800A0005 when using set objFile = objFSO.OpenTextFile
body: <p>I have searched this error code numerous times and have gone to numerous sites to read responses.  Long story short, still haven't found a solution.</p>
  
  <p>One page referenced: <a href="https://stackoverflow.com/questions/10090602/error-while-sending-character-with-sendkeys-in-vbscript">Error while sending ( character with sendkeys in vbscript</a></p>
  
  <p>Here is my code:</p>
  
  <pre><code>set WshShell = WScript.CreateObject("WScript.Shell")
  Return = WshShell.Run("C:\Downloads\software\putty.exe -load navstat")
  
  DIM date 
  date = 301113
  
  DIM tran1
  tran1 = TAFFY
  
  set objFSO = CreateObject("Scripting.FileSystemObject") 
  set objFile = objFSO.OpenTextFile("C:\Users\Adrian\Desktop\Entries1.txt", ForReading) 
  
  Do Until objFile.AtEndOfStream 
      strLine = objFile.ReadLine 
      If InStr(strLine, "JFK.GREKI3.MARTN..TOPPS") Then 
          set indi = 2 
          set tran1 = TOPPS 
      End If
  Loop
  </code></pre>
  
  <p>What's going on:  I am scanning a .txt file (Entries1.txt) for text strings.  If they occur I need to set corresponding indi values (so when indi is used later as a variable it will use the correct #) and change the tran1 variables as well.</p>
  
  <p>For some reason I'm getting an error at:</p>
  
  <pre><code>set objFile = objFSO.OpenTextFile
  </code></pre>
  
  <p>The error is</p>
  
  <blockquote>
    <p>Invalid procedure call or argument
    Code: 800A0005</p>
  </blockquote>
  
  <p>Help would be greatly appreciated.</p>