< Day Day Up > |
Understanding File I/OThe term file I/O refers to file input and output functions, which is one way to manipulate the contents of a file. Although you might never use I/O functions, you might run into them in legacy applications that you must support. The VBA I/O process is simple:
Before you can use I/O to manipulate a file's contents, you need to know the file's handle. Within this context, a file handle is simply a number that uniquely identifies the open files to the operating system. To open an I/O file, you need an unused file handle. Acquire this value using the FreeFile function in the form hFile = FreeFile where hFile is a Long Integer variable. CAUTION Chapter 23 is an introduction to using Windows API functions, which also uses file handles. You can't use the result of the VBA FreeFile function when working with an API. |
< Day Day Up > |