Example - Kill Statement
Const NumberOfFiles = 3
Sub Main ()
Dim Msg, Folder 'Declare variable.
Folder = "D:\Temp\"
Call MakeFiles(Folder) 'Create data files.
Msg = NumberOfFiles & " test files have been created in your " & Folder & " directory."
Msg = Msg & " You should be able to see them in that folder now. Click OK to remove the test files."
MsgBox Msg
For I = 1 To NumberOfFiles
Kill Folder & "TEST" & I 'Remove data files from disk.
Next I
End Sub
Sub MakeFiles (Folder)
Dim I, FNum, FName 'Declare variables.
For I = 1 To NumberOfFiles
FNum = FreeFile 'Determine Next file number.
FName = Folder & "TEST" & I
Open FName For Output As FNum 'Open file.
Print #FNum, "This is test #" & I 'Write String To file.
Print #FNum, "Here is another ";"line";I
Next I
Close 'Close all files.
End Sub