File.Delete Method (VB6)

Named Parameters

Yes

Syntax

oFileObj.Delete [Force]


oFileObj

Use: Required

Data Type: File object

Any object variable returning a File object.


Force

Use: Optional

Data Type: Boolean

If set to True, ignores the file's read-only flag (if it's on), and deletes the file.

Description

Removes the current file.

Rules at a Glance

  • If the file is open, the method fails with a "Permission Denied" error.

  • The default setting for Force is False.

  • If Force is set to False, and the file is read-only, the method will fail.

Programming Tips and Gotchas

  • Unlike the FileSystemObject object's DeleteFile method, which accepts wildcard characters in the path parameter and can therefore delete multiple files, the Delete method deletes only the single file represented by oFileObj.

  • As a result of the Delete method, the Files collection object containing oFileObj is automatically updated, the deleted file is removed from the collection, and the collection count reduced by one. You shouldn't try to access the deleted file object again; instead, you should set oFileObj to Nothing.

See Also

FileSystemObject.DeleteFile Method, Kill Statement
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.11.20