Deletes a file.
- Type: Text or codeThe name of the file that you want to delete,
including the path. When you enter the path, consider these
- You can omit the drive designation if the
file is located on the current drive.
- You can omit the full path if the file is
located in the current directory.
- You can enter only the subdirectory name if
the file is located in a subdirectory of the current
- You can omit the drive designation if the file is located on the current drive.
Property Value/Return Value
Specifies whether the file was deleted.
true if the file was deleted; otherwise, false.
If you omit this optional return value and the file is not deleted, a run-time error occurs. If you include the return value, you must handle any errors.
If the user who runs this function does not have the required permission to delete the file or if the file is read-only, then the file is not deleted.
The following example deletes the file that is named C:\TestFolder\NewTestFile.txt.This example assumes that you have created the file on your computer.