Hi,
I created a macro to return the file type of a file.
The name of the file is clock.avi.
The fold is C:\WINDOWS.
Please see below for the macro I created.
When I run the macro, there is a problem of "user-defined type not defined.
Please see the picture below.
Could you please amend my macro so that it works?
My macro:
[vba]Sub Get_File_Type()
Dim objShell As Shell
Dim objFolder As Folder
Set objShell = New Shell
Set objFolder = objShell.Namespace("C:\WINDOWS")
Dim objFolderItem As FolderItem
Set objFolderItem = objFolder.ParseName("clock.avi")
Range("a1") = objFolder.GetDetailsOf(objFolderItem, 2)
End Sub
[/vba]
In fact, I just modify the macro based on
http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx
[vba]
Private Sub btnGetDetailsOf_Click()
Dim objShell As Shell
Dim objFolder As Folder
Set objShell = New Shell
Set objFolder = objShell.NameSpace("C:\WINDOWS")
If (Not objFolder Is Nothing) Then
Dim objFolderItem As FolderItem
Set objFolderItem = objFolder.ParseName("clock.avi")
If (Not objFolderItem Is Nothing) Then
Dim szItem As String
szItem = objFolder.GetDetailsOf(objFolderItem, 2)
End If
Set objFolderItem = Nothing
End If
Set objFolder = Nothing
Set objShell = Nothing
End Sub
[/vba]
Thanks