BLOGS BY TOPIC
BLOGS BY AUTHOR
BLOGS BY YEAR
The easiest way to work with text files in VBA is using TextStream objects - this blog explains how they work.
- Reading and Writing Text Files using TextStreams (this blog)
- Creating a Text File and Writing Lines
- Reading in Lines from a Text File
Posted by Andy Brown on 13 January 2012
You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.
Reading and Writing Text Files using TextStreams
This blog shows how to read from (and write to) text files using something called TextStream objects.
There is another way to do this in VBA using commands like Input and Open, but I think the way shown here is much easier to remember and use.
In order to get any of the code in this blog to work, you first need to create a FileSystemObject.