Đầu tiên, vào cửa sổ VBE, trong menu Tools\References, bạn check mục "Microsoft Shell Controls And Automation"Chào các bạn
Trong bản nhạc có cột thời lượng . Nhờ các bạn giúp cho đoạn code trích ra cột này.
Cảm ơn
Function GetMp3Duration(ByVal mp3File As String)
On Error Resume Next
Dim fldName As String, fleName As String
With CreateObject("Scripting.FileSystemObject")
fldName = .GetFile(mp3File).ParentFolder
fleName = .GetFile(mp3File).Name
End With
With New Shell
With .Namespace(fldName)
GetMp3Duration = .GetDetailsOf(.ParseName(fleName), 21)
End With
End With
End Function
Function GetMp3Duration(ByVal mp3File As String)
On Error Resume Next
Dim fldName As String, fleName As String
With CreateObject("Scripting.FileSystemObject")
fldName = .GetFile(mp3File).ParentFolder.Path
fleName = .GetFile(mp3File).Name
End With
With CreateObject("Shell.Application")
With .Namespace("" & fldName & "")
GetMp3Duration = .GetDetailsOf(.ParseName("" & fleName & ""), [COLOR=#ff0000][B]21[/B][/COLOR])
End With
End With
End Function
DIỄN ĐÀN GIẢI PHÁP EXCEL Group 1
DIỄN ĐÀN GIẢI PHÁP EXCEL Group 2