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 post, you’ll learn how to Find Blank cells in excel so that you can remove or delete the blank cells form...
In this article, you’ll learn what is a Gauge Chart in Microsoft Excel. Also, you will learn how to add...
Microsoft Excel provides a shortcut for the users to move columns in excel using two different ways – using Shift...