Sunday, May 13, 2007

Killing Files


Killing or deleting files is easy. However the files must not be in used.

Sub Killfile()
Dim MyFile As String 'This line of code is optional
On Error Resume Next 'On hitting errors, code resumes next code
MyFile = "c:\folder\filename.xls"
kill MyFile
End Sub

Wildcards can be use. Replace the file name with * (use with caution!).

No comments:

Post a Comment