0

I currently have two columns. Column A contains a list of file names (with extension) and column B contains the date it was last modified. I wanted to create a macro that loops through the list of files and scans through a file path with folders and subfolders and prints the exact link to the table in column C. It should be noted that the subfolders contain the same files which have been created/modified on different dates, however I wish to obtain the link to the file with the same timestamp as column B. I have written a few lines of code but I am struggling to put together the logic needed.

Sub tester()

path = ""
fname = "Book1.csv"

x = Dir(path & "\" & fname)

If x = fname Then

    link = path & "\" & fname

    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFile(link)
    created = f.DateCreated

Else
    link = "Not Found"
End If
cybernetic.nomad
  • 6,100
  • 3
  • 18
  • 31
  • Are you getting an error? What exactly is the problem? – Jonathan Alfaro May 29 '19 at 15:39
  • I am having trouble putting together a code that does what I need it to. I am new to using VBA and have been thrown in the deep end a little. – Dilan Chudasama May 29 '19 at 15:47
  • 2
    Yes. But here most people are not going to provide you with code. We are only going to help you fix your code. So the first thing you need to do is try to do it yourself... then post the code here. – Jonathan Alfaro May 29 '19 at 16:08
  • This may help for ideas: https://stackoverflow.com/questions/20687810/vba-macro-that-search-for-file-in-multiple-subfolders – Jan May 29 '19 at 19:55

0 Answers0