Delete Selected Files

Files are stored in a sub-directory of 'Stox', an application I created. The files to delete are all called PL???.XLS and are part of a stock control program.

Sub DeleteStockFile()
   strPath = "c:\program files\stox\plists\pl" ' the folder path & file prefix to the files
   strItemNum = InputBox("Enter Picking List No. i.e. 50", "Picking List Number")
   strFileName = strPath & strItemNum & ".xls"
   On Error GoTo Error_Handler
   Kill strFileName
   Exit Sub
   MsgBox "Error deleting file..."
End Sub

You might also like...


Neil Derek


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.” - Tom Cargill