Vba Delete File

[Solved] Vba Delete File | Vb - Code Explorer | yomemimo.com
Question : vba delete file

Answered by : vastemonde

' Needs to add "Microsoft Scripting Runtime" reference to your file
Function FileExists(ByVal FileToTest As String) As Boolean FileExists = (Dir(FileToTest) <> "")
End Function
Sub DeleteFile(ByVal FileToDelete As String) If FileExists(FileToDelete) Then 'See above ' First remove readonly attribute, if set SetAttr FileToDelete, vbNormal ' Then delete the file Kill FileToDelete End If
End Sub

Source : https://stackoverflow.com/questions/67835/deleting-a-file-in-vba | Last Update : Sun, 07 Feb 21

Answers related to vba delete file

Code Explorer Popular Question For Vb