facebook

Articles

VBA - Killing Files* 01/12/2001

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!).