can you help me with my macro to delete a text file? I need to erase the file test.log (if exist) in the location of the system folder "%TEMP%\test.log".
To be precise: "%TEMP%" = Environ("TEMP")
Below is the code you need to edit.
Sub DeleteFile(ByVal FileToDelete As String)
Dim aFile As String
sTemp = Environ("TEMP")
aFile = '<-You need to set the path to the file (test.log), it can be deleted.
If Len(Dir$(aFile)) > 0 Then