Return Creation Date

bjurney

Active Member
Joined
Aug 24, 2009
Messages
320
I am trying to modify this bit of code to tell me the date the file was created on, I tried several diffrent things, but I cant seem to figure it out:

Code:
With Application.FileSearch
    .LookIn = "C:\My_Folder\"
    .Filename = Range("A1").Value
    If .Execute > 0 Then
        MsgBox "There were " & .FoundFiles.Count & _
            " file(s) found."
        For i = 1 To .FoundFiles.Count
            MsgBox .FoundFiles(i)
        Next i
    Else
        MsgBox "There were no files found."
    End If
End With

Hope someone can help!
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Great thanks! I was able to get an idea of what I needed to do although I kind of went my own way. Here is the code I used in case someone ever needs a similar thing

Code:
Sub find()
Dim i, oFSO, File_Name2
With Application.FileSearch
    .LookIn = "C:\My_Folder"
    .Filename = Range("A1").Value
 
    .MatchAllWordForms = False
    If .Execute > 0 Then
        For i = 1 To .FoundFiles.Count
            Set oFSO = CreateObject("Scripting.FileSystemObject")
            Set File_Name2 = oFSO.GetFile(.FoundFiles(i))
            MsgBox (Format((File_Name2.DateCreated), "mm/dd/yyyy"))
 
            Next i
    Else
        MsgBox "There were no files found."
    End If
End With
 
 
 
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,534
Messages
6,179,390
Members
452,909
Latest member
VickiS

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