Need to get modified date

M

Michael Wise

I have some code that searches files with specific contents within the
file and returns the file name to a selection box. The selection box
currently contains the file name. I am needing it to also include the
modified date within this box. Here is the code i'm currently using.
Can any help me with getting the modified date added in as part of the
information provided. Thank you,
Michael

Sub Locatefile()


Dim I As Integer
Worksheets("Data").Select
Cells.Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
Range("A1").Select
5 si = Worksheets("Setup").Range("C4")
Path = Worksheets("Setup").Range("F3")
With Application.FileSearch
..NewSearch
..LookIn = Path
..TextOrProperty = "COST CENTER = " & si
..MatchTextExactly = True
..Filename = "*.txt"
..Execute


If .FoundFiles.Count = 0 Then GoTo 5
For I = 1 To .FoundFiles.Count
If .FoundFiles.Count = 1 Then
Workbooks.Open .FoundFiles(I)
End If
If .FoundFiles.Count > 1 Then
UserForm1.ComboBox1.AddItem .FoundFiles(I)
End If

Next

End With
UserForm1.Show
foundfileopen
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top