Skip to main content

Delete method

Table of contents
  1. Syntax
  2. Remarks

Deletes a specified file or folder.


object.Delete force

The Delete method syntax has these parts:

Part Description
object Required. Always the name of a File or Folder object.
force Optional. Boolean value that is True if files or folders with the read-only attribute set are to be deleted; False (default) if they are not.


An error occurs if the specified file or folder does not exist.

The results of the Delete method on a File or Folder are identical to operations performed by using FileSystemObject.DeleteFile or FileSystemObject.DeleteFolder.

The Delete method does not distinguish between folders that have contents and those that don't. The specified folder is deleted regardless of whether or not it has contents.

Leave a comment

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

Format your code: <pre><code class="language-vba">place your code here</code></pre>