File attributes

Vagelisr

New Member
Joined
Sep 22, 2016
Messages
28
Office Version
  1. 2010
  2. 2007
Platform
  1. Windows
Hi to all.

I use this simple code to find all the files in a folder or in a folder and sub folders.
Excel Formula:
Private Sub GetFiles(ByVal Path As String)
    Dim FSO As Object, Fldr As Object, subF As Object, File As Object
    Set FSO = CreateObject("Scripting.FileSystemObject")
    Set Fldr = FSO.GetFolder(Path)
    'Check in Subfolders
    If Worksheets("Parm").Cells(2, 2).Value = True Then
        For Each subF In Fldr.SubFolders
            GetFiles (subF.Path)
        Next subF
    End If
    For Each File In Fldr.Files
        If LCase(Right(File.Path, Len(Worksheets("Parm").Cells(1, 2).Value))) = Worksheets("Parm").Cells(1, 2).Value Then
            ActiveSheet.Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Resize(, 5) = Array(File.Path, File.Name, File.Name, File.Size, File.DateCreated)
        End If
    Next File

    Set FSO = Nothing
    Set Fldr = Nothing
    Set subF = Nothing
    Set File = Nothing
    Columns("A:AJ").AutoFit
End Sub

I would like to know how can i bring also the attributes of these files

Thanks and regards.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
How about
VBA Code:
File.Attributes
 
Upvote 0
First of all thanks for your reply.
I probably did not let you understand what i want.
I want from VBA to find the details of a file like Date Last Modified, Date Created, Author etc

Thanks again.
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,685
Members
448,977
Latest member
dbonilla0331

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top