![]() Public Function FSO_GetFileInfo(ByVal sFile As String) ' Added Early Binding sample declarations ' 2 Updated proc Name, variable naming to standardize ' sFile : Fully qualified path & filename with extension of the file to report on ![]() ' Req'd Refs: Uses Late Binding, so none required ' Copyright : The following is release as Attribution-ShareAlike 4.0 International ' Could return an Array, Dictionary Object. ' Right now, print result to the VBA immediate window ' Purpose : Retrieve some basic file information ' Author : Daniel Pineault, CARDA Consultants Inc. To illustrate how you can use FSO, here is a simple VBA example of how you can get some basic file properties '. As I have seen a number of similar questions over the years, I thought I would add it to my blog in the hopes it may help someone else out.Īlthough there are a few build-in functions (such as: FileLen() – do not FileLen() as it is unreliable!, FileDateTime()), because we needed other more advanced properties, at the end of the day, the easiest method to get such information is to use the File System Object ( FSO) to extract the relevant information regarding each file and I demonstrate how this is done. Rather than populate a control on a form, could I create a collection to hold the filenames and attributes that I can then pass to another module to process? If so, any tips on how to create and then reference items in the collection?įinally created a small demo database to illustrate how it could all be pieced together in a seamless manner. ![]() I also need to be able to get and store some of the attributes of each file, specifically the date created, date last changed, and current file size. I need to extract a list of the names of all the files in a specific directory.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |