I referenced Microsoft Shell Controls And Automation
I created a function and called it using something like this ...
Code:
Dim strPath As String
Dim strFilename As String
strPath = "C:\Test\VideoFiles\"
strFilename = "IntroVBA_Tutorial01.wmv"
MsgBox GetMediaFileLength(strPath, strFilename)
Here is the function
Code:
Public Function GetMediaFileLength(ByVal p_FolderPath As String, ByVal p_FileName As String) As String
If p_FolderPath <= "" Or p_FileName <= "" Then
MsgBox "Please provide a folder and a path."
Exit Function
End If
GetMediaFileLength = "No File Found"
Dim objShell As New Shell
Dim objFolder As Folder3
Dim objFile As FolderItem
Set objFolder = objShell.NameSpace(p_FolderPath)
For Each objFile In objFolder.Items
If objFile.Name = p_FileName Then
GetMediaFileLength = objFolder.GetDetailsOf(objFile, 27)
End If
Next objFile
End Function