Steve R.
Retired
- Local time
- Today, 16:08
- Joined
- Jul 5, 2006
- Messages
- 5,674
I've been trying to figure out how to extract extended file properties in Access. Apparently the FileSystem object only returns the standard set of file properties, such as the name of the file. Microsoft has a description of how to use VBA to retrieve extended file properties, such as the author of a file.
Additionally, stngman posted in UtterAccess an approach on how to retrieve extended file properties in Access.
The approach used by stngman, while it works, appears to require a lot of looping. I was hoping to avoid this looping since my program is already looping through the files. Alas, all that I have been able to get is the name of the extended property NOT the actual value. See the line of code in bold red.
Based on the Microsoft table, the file property with the value of "0" should return the actual name of the file, but all I get is the the name of the field which is "name". Any Thoughts?
Additionally, stngman posted in UtterAccess an approach on how to retrieve extended file properties in Access.
The approach used by stngman, while it works, appears to require a lot of looping. I was hoping to avoid this looping since my program is already looping through the files. Alas, all that I have been able to get is the name of the extended property NOT the actual value. See the line of code in bold red.
Based on the Microsoft table, the file property with the value of "0" should return the actual name of the file, but all I get is the the name of the field which is "name". Any Thoughts?
Code:
Public Sub Create_File_List(InputPath As String)
Dim CopyMP3RS As DAO.Recordset
Dim Fso As Object
Dim Fldr As Object
Dim SubFldr As Object
Dim F As Object
Rem New Shell.Application Code Below -----------------------------------
Dim objShell As Object
Dim ojbFolder As Object
Set objShell = CreateObject("Shell.Application")
Rem Rem New Code Above --------------------------------
Set Fso = CreateObject("scripting.filesystemobject")
Set Fldr = Fso.GetFolder(InputPath)
Set CopyMP3RS = CurrentDb.OpenRecordset("SELECT * FROM tblMP3_FileList", dbOpenDynaset)
For Each F In Fldr.Files
Debug.Print "Name"; Fldr.Name, "type; "; Fldr.Type, "Path: "; Fldr.Path
Set objFolder = objShell.NameSpace(Fldr.Path & "\")
If Right(F.Name, 4) = ".mp3" Then
CopyMP3RS.AddNew
[COLOR="Red"][B]Debug.Print "File: "; F.Name, objFolder.GetDetailsOf(F.Name, 0)[/B][/COLOR]
CopyMP3RS!FileLocation = F.Path
CopyMP3RS!FileName = F.Name
CopyMP3RS!FileSize = F.Size
CopyMP3RS.Update
End If
Next F
Rem ---------------------------------------
For Each Fldr In Fldr.SubFolders
Call Create_File_List(Fldr.Path)
Next Fldr
End Sub