I have the following code which, when called, will display the folder contents as a list on a dashboard in Excel:
Sub DisplayInProgressBeth()
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Dim i As Integer
Range("S29:S38").Select
Selection.ClearContents
'Create an instance of the FileSystemObject
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Get the folder object
'Set objFolder = objFSO.GetFolder("\\SVR-CC-DC01\Shared\AMLC\AMLC - In Progress\Beth")<--old location on the S: drive
Set objFolder = objFSO.GetFolder("\\Svr-cc-dc01\amlc\AMLC - In Progress\Beth")
i = 1
'loops through each file in the directory
For Each objFile In objFolder.Files
'select cell
Range(Cells(i + 28, 19), Cells(i + 28, 19)).Select
'create hyperlink in selected cell
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
objFile.path, _
TextToDisplay:=objFile.Name
i = i + 1
Next objFile
Range("S24").Select
End Sub
However, what I need is to also display the last modified date/time in the adjacent cell on the dashboard (starting in T29). I'm not sure how to call this for each individual, corresponding file found in the folder.
Just to be clear, the result should look something like this:
___________COLUMN-S_____COLUMN-T
ROW 29.....File1.xlsm..........2/24/20 5:24PM
ROW 30.....File2.xlsm..........2/24/20 3:16PM
ROW 31.....File3.xlsm..........2/25/20 8:03AM
Ideas/solutions?
Thanks!
Sub DisplayInProgressBeth()
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Dim i As Integer
Range("S29:S38").Select
Selection.ClearContents
'Create an instance of the FileSystemObject
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Get the folder object
'Set objFolder = objFSO.GetFolder("\\SVR-CC-DC01\Shared\AMLC\AMLC - In Progress\Beth")<--old location on the S: drive
Set objFolder = objFSO.GetFolder("\\Svr-cc-dc01\amlc\AMLC - In Progress\Beth")
i = 1
'loops through each file in the directory
For Each objFile In objFolder.Files
'select cell
Range(Cells(i + 28, 19), Cells(i + 28, 19)).Select
'create hyperlink in selected cell
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
objFile.path, _
TextToDisplay:=objFile.Name
i = i + 1
Next objFile
Range("S24").Select
End Sub
However, what I need is to also display the last modified date/time in the adjacent cell on the dashboard (starting in T29). I'm not sure how to call this for each individual, corresponding file found in the folder.
Just to be clear, the result should look something like this:
___________COLUMN-S_____COLUMN-T
ROW 29.....File1.xlsm..........2/24/20 5:24PM
ROW 30.....File2.xlsm..........2/24/20 3:16PM
ROW 31.....File3.xlsm..........2/25/20 8:03AM
Ideas/solutions?
Thanks!