0

I currently am checking if files exist using a function and some follow up code. But I would like to get some attributes such as name, last update date, author, etc and print to excel cells.

Function FileExists(FilePath As String)
Dim TestStr As String
TestStr = ""
On Error Resume Next
TestStr = Dir(FilePath)
OnError GoTo 0
If TestStr = "" Then
FileExists = False
Else
FileExists = True
End If
End Function

then I am using the following code which works, but how do I improve to gather attributes...

Sub CheckFileExists1 ()
Dim strFile As String
strfile = "File_Name.xlsm"
If FileExists(strFile) then
Range("A2") = "File Exists"
Else
Range("A2") = "File not Found"
End If
End Sub

Any help greatly appreciated. Thank you

Dice_Rolls
  • 21
  • 1
  • Take a look [here](https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/file-object). – findwindow Sep 27 '22 at 19:35

0 Answers0