Hi. I have a section of code which opens all the files in a folder and captures some data from it. How can I also capture the name of the each file and store it in cell so that the data collected can be correctly referenced. My code is along the following lines


strPath = "Folder Path"
strFilename = Dir(strPath & Application.PathSeparator & "*.xls*")

'Loop through all workbooks in folder
Do Until Len(strFilename) = 0

'Set the current workbook it has found as the source workbook
Set wbSrc = Workbooks.Open(strPath & Application.PathSeparator & strFilename)

[Code for collecting data is in here]

'close workbook
wbSrc.Close False

strFilename = Dir

Loop

Any way of storing the name of each file every time it loops so I can paste it in a cell?

Thanks