I have a sub in Access, posted below, which uses the Microsoft Scripting Runtime library, to determine files properties but, using Intellisense to see the list of all the properties available in VBA for Scripting.File, I don’t see a Length(hour, minutes, seconds) property, there’s only a Size property. But I know that if, in Windows Explorer, you hover the mouse over an audio file name, it also shows its time length, is there a way to get that in VBA?
Public Sub GetFilesNamesFromFolder(strFolderPath As String) On Error GoTo ErrorHandler Dim fso As Scripting.FileSystemObject Dim fld As Scripting.Folder Dim fil As Scripting.File Dim strSQL As String Dim dbs As DAO.Database Dim rst As DAO.Recordset Dim strPrompt As String Dim strTitle As String Dim strTable As String Dim intMissingCount As Integer strTable = "tblFilesFromFolder" Set fso = CreateObject("Scripting.FileSystemObject") If Not fso.FolderExists(strFolderPath) Then 'Specified folder does not exist strPrompt = "Please enter a valid folder path" strTitle = "Folder path not found" MsgBox strPrompt, vbCritical + vbOKOnly, strTitle GoTo ErrorHandlerExit Forms![fdlgSelectFolder].SetFocus Else 'Folder exists Set dbs = CurrentDb Set rst = dbs.OpenRecordset(strTable) Set fld = fso.GetFolder(strFolderPath) For Each fil In fld.Files If fil.Name = "DSSMANAGEMENT.Dat" Then GoTo mm rst.AddNew rst![FileName] = fil.Name If Forms!fdlgSelectFolder!m Then rst![DateChecked] = fil.DateLastModified Else rst![DateChecked] = fil.DateCreated End If rst.Update mm: Next fil End If ErrorHandlerExit: Exit Sub ErrorHandler: If Not Err = 3022 Then MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description Else: MsgBox "You already have all or some of the files you want to import." End If Resume ErrorHandlerExit End Sub