Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Dim strPath As String
Dim strName As String
strPath = Environ("USERPROFILE") & "\Desktop\REQUIRED FILES\ART REPORT"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strPath)
For Each objFile In objFolder.Files
If objFile.DateLastModified > varDate Then
strName = objFile.Name
End If
Next
Application.Workbooks strPath.strName.Open, vbNormalNoFocus
The above code is to check the folder (strPath) for the latest file saved, store the file name in strName and then open that workbook.
I can't seem to find how i'm supposed to refer to the said file using the variables.
Any help would be much appreciated. Thanks
EDIT: Referring to the answers in the following link didn't solve my problem. I keep getting Error 1004 Other Question