can you help me with my macro to delete a file? When I start writing on the fifth row of the error: Run-time error '424' - Object required
Thank you in advance.
Dim fso, sTemp
Dim file As String
sTemp = Environ("TEMP")
file = sTemp & "\" & student_scores.Log
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(file) Then
fso.DeleteFile file, True
MsgBox file & " does not exist or has already been deleted!" _
, vbExclamation, "File not Found"