Académique Documents
Professionnel Documents
Culture Documents
Note Used with simple text files. Used for files that are composed of a series of records of identical length. Used for files with no general format. You must know exactly how the data is written to the file in order to retrieve it.
Function's Action Closes the file Tests for end of file Returns the next file number available for use by the Open statement. Reads data from a file at a specific record number Returns all characters (bytes) from an open file Reads a line of text into a list of variables Reads an entire line of text into a single variable Returns the current read/write position within an open file. Returns the size, in bytes, of a file opened using the Open statement Opens a file with a specified access type Writes data to a file at a specific record number Returns the current read/write position within a file opened using the Open statement Writes data to a file opened for sequential access
Sequential Access X X X
Random Access X X X
Binary Access X X X
Get Input$ Input # Line Input # Loc LOF Open Put Seek
X X X X X X X X X X X X X
X X
X X X X X
Write #
Disadvantages of Sequential Access: It is not well suited for storing large amounts of data because all values are stored as a character string. Usually requires more storage space than the other access types. You cannot read and write to a file that is opened for sequential access. You can only do one or the other at any given time.
Description Input characters to the file. Output characters to the file. Append characters to the end of the file.
To open a file for any one of these operations use the Open statement: Open filename For [Input | Output | Append] As filenumber Len=buffersize When you use sequential access to open a file for Input, the file must already exist; otherwise Visual Basic for Applications generates a trappable error. When you try to open a nonexistent file for Output or for Append, the Open statement will actually create the file first and then open the empty file. Each time you open a file you must Close it before reopening the file for another type of operation.