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

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

In this article, you will learn about the SKEW.P function, the formula syntax and usage of the function in Microsoft...
In this article, you will learn about the SKEW function, the formula syntax and usage of the function in Microsoft...
In this article, you will learn about the RANK.EQ function, the formula syntax and usage of the function in Microsoft...
  • Excel
  • November 23, 2021