Microsoft Office Tutorials and References
In Depth Information
8.6 A Final Note on VBA
8.6 A Final Note on VBA
There is a lot more to the VBA language than we have covered here. In fact, the VBA reference
manual is about 300 pages long. However, we have covered the main points needed to begin Excel
VBA programming. [1]
[1] If you'd like a good reference guide to the VBA language, see VB & VBA in a Nutshell: The Language ,
written by Paul Lomax and published by O'Reilly & Associates.
Actually, many Excel VBA programming tasks require only a small portion of VBA's features and
you will probably find yourself wrestling much more with Excel's object model than with the
VBA language itself.
We conclude our discussion of the VBA language per se with a brief outline of topics for further
study, which you can do using the VBA help files.
8.6.1 File-Related Functions
VBA has a large number of functions related to file and directory housekeeping. Table 8-1
contains a selection of them.
Table 8-1 Some VBA File and Directory Functions .
Find a file with a certain name.
Get the length of a file.
Get the date stamp of a file.
Copy a file.
Delete a file.
Rename a file or directory.
Delete a directory.
Make a new directory.
In addition to the file-related functions in Table 8-1 , there may be times when it is useful to create
new text files to store data. VBA provides a number of functions for this purpose, headed by the
Open statement, whose (simplified) syntax is:
Open pathname For mode As [#] filenumber
Once a file has been opened, we can read or write to it.
8.6.2 Date- and Time-Related Functions
VBA has a large number of functions related to manipulating dates and times. Table 8-2 contains
a selection.
Table 8-2. Some Date- an d Time-Related Functions
Date, Now, Time
Get the current date or time.
Search JabSto ::

Custom Search