Databases Reference
In-Depth Information
'We are done here
Exit Function
'Error Handling
File_Unavailable:
FileAttrib = "Unknown"
End Function
The function FileAttrib is a bit more problematic to code because a file can have many
attributes. A drive, for example, can only be of one type; it cannot be both a hard disk and a CD-
ROM. A file, however, can be both a hidden file and a system file. Because a file can have many
attributes, it becomes more problematic to develop a unique number to represent all the possible
attributes a file may have. The attributes property utilizes binary numbers to overcome this difficulty.
This function decodes the binary number returned utilizing the attributes property, and constructs
a string for function returns that contains all the file's attributes separated by spaces.
2.15
SUMMARY
The purpose of this chapter is to teach the reader how to move data in and out of Microsoft Excel
utilizing the many tools available within the Visual Basic for the Applications development envi-
ronment. Loading and saving data both automatically and with dialog boxes is covered, as well as
the creation of files suitable for export to a database. More advanced facets of file manipulation
are also covered, including how to determine the subfolders at a given location, create an array
containing the names of files and subfolders at a given location, and how to store last-known file
locations to the Windows Registry. It is also shown how to utilize the Windows Registry to store
information pertaining to file input-output (I/O) operations in a manner such that the information
can be retrieved and utilized whenever a load or save dialog box is opened. This section also covers
how to obtain drive, directory, and file properties utilizing the FileSystemObject , Drive ,
and File objects.
Search WWH ::




Custom Search