There is a lot more to the VBA language than I have covered here. (In fact, the VBA reference manual is about 300 pages long.) However, I have covered the main points needed to begin Word VBA programming.
Actually, many Word VBA programming tasks require only a small portion of VBA’s features; you will probably find yourself wrestling much more with Word’s object model than with the VBA language itself.
I 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.
VBA has a large number of functions related to file and directory housekeeping. Some of these are:
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 these file-related functions, there may be times when it is useful to create new text files (as opposed to Word files) to store data. VBA provides a number of functions for this purpose, headed by the
Open statement, whose (simplified) syntax is:
Once a file has been opened, you can read or write to the file. I want to emphasize that opening files in this way creates text files, not Word documents.
VBA has a large number of functions related to manipulating dates and times. Some of these ...