Delete file from the folder using Excel VBA

If you have a scenario where you want to delete a file from your laptop using Excel VBA, here’s a way showing how you can do it.

How to Delete File from Folder using Excel VBA?

In the below code snippet in Excel VBA, we use the Kill method to delete the file. Note that this will delete the file and only try the below code snippet if you know what you are doing.

Sub DeleteFile()

	On Error Resume Next

	Kill "c:\developerpublish.txt"

End Sub