# File open, process, close

Keywords:
Situation:

You have data in a file that you want to process.

Actions:
• Use the "Open" statement to open the file.
• Do your processing.
• Use the "Close" statement to close the file.

See the Explanation of this pattern for code.

Explanation:

Code example:

1. Open ThisWorkbook.Path & "\filename.txt" For Input As #1
2. ...
3. Close #1
Instead of Input, you could use Output or Append. Line 1 assumes the file is in the same folder as the workbook containing the code.