File Input and Output IO

VBA includes several objects, methods, and functions that can be used for file I/O. You have probably surmised that one possibility for file I/O involves the Workbook object and its methods for saving and opening files; however, there are other tools available in VBA, the most relevant of which will be discussed in this chapter.

When a VBA application requires file I/O, it often involves a relatively small amount of data stored in program variables, and not in a worksheet or document. With Excel, the programmer has the choice of copying the data to a worksheet so the user can save the data in the usual way (File/Save menu item), or saving the content of the variables directly to a file. It is often

The Locals window.

The Locals window.

Vb6 Open Dir

more convenient to simply write the data directly to a file on the hard drive so the user does not have to be concerned with the task. In fact, it may be undesirable to give the user access to the data, as he or she might alter it before saving. In this case, reading and writing simple text files within the program code offers an attractive solution.

Biorhythm Awareness

Biorhythm Awareness

Who else wants to take advantage of biorhythm awareness to avoid premature death, escape life threatening diseases, eliminate most of your life altering mistakes and banish catastrophic events from your life.

Get My Free Ebook


Post a comment