Are you only wanting to see file properties?
If so, here is a different way to achieve that....
- user form used
- file dialog allows user to select a file
- listing of properties dumped to ListBox and to sheet "Values"
Test in attached file by clicking on button.
UserForm code....
Private Sub cb_ChooseFile_Click()
Dim fName As String, Divider As Integer, FolderPath As String, FileName As String
Application.ScreenUpdating = False
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = False
.Show
On Error Resume Next
fName = .SelectedItems(1)
Divider = InStrRev(fName, "\")
MyFolderPath = Left(fName, Divider - 1)
MyFileName = Mid(fName, Divider + 1, Len(fName) - Divider)
End With
Call GetValues(MyFolderPath, MyFileName)
Application.ScreenUpdating = True
Me.ListBox1.List = Sheets("Values").Range("A1").CurrentRegion.Offset(, 1).Resize(, 2).Value
End Sub
Private Sub GetValues(MyFolderPath, MyFileName)
Dim cObj As Object, r As Integer, x As Integer, myValue As String, myDesc As String, ws As Worksheet
Set ws = Sheets("Values"): ws.Range("A1:C288").ClearContents
Set cObj = CreateObject("shell.application").Namespace(MyFolderPath)
With cObj
For x = 0 To 288
On Error Resume Next
myValue = .getdetailsof(.Items.Item(MyFileName), x)
myDesc = .getdetailsof(vbNull, x)
If x = 0 Then Me.Label1 = myValue
If myValue <> "" Then
r = r + 1
With ws
.Cells(r, 1).Value = x
.Cells(r, 2).Value = myDesc
.Cells(r, 3).Value = myValue
End With
End If
Next
End With
End Sub
YasserKhalil v1 File Properties.xlsm
Bookmarks