|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
File System ObjectSorry to raise the following but I have been fidling with the File System
object for some time, varying the approach to the file and I still can not get to delete a file. I would be really grateful if someone would point out the error in the following code. The system says the Method is not supported raleigh Dim fs, f, fl, fc, s, obj Dim fobject As Object Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.GetFolder(vsPath & "ThisYearsCompetition") Set fc = f.Files For Each fl In fc s = f & "\" & fl.Name fl.DeleteFile s, True Next Roger,
If you're using VB6 or below (which this NG is designed for), have you tried using the built in Dir() and Kill. No need for an FSO. If you're scripting, then you should check the methods of this object: You are confusing the FSO.DeleteFile with the File.Delete, to give the non-existent File.DeleteFile. NickHK Show quoteHide quote "Roger Stenson" <r.sten***@paston.co.uk> wrote in message news:ufvPf.70318$mf2.523@newsfe6-win.ntli.net... > Sorry to raise the following but I have been fidling with the File System > object for some time, varying the approach to the file and I still can not > get to delete a file. I would be really grateful if someone would point out > the error in the following code. The system says the Method is not supported > raleigh > > Dim fs, f, fl, fc, s, obj > Dim fobject As Object > Set fs = CreateObject("Scripting.FileSystemObject") > Set f = fs.GetFolder(vsPath & "ThisYearsCompetition") > Set fc = f.Files > For Each fl In fc > s = f & "\" & fl.Name > fl.DeleteFile s, True > Next > >
Form_Load and SetFocus
What line does the error start on? Setting background in vscrollbar to gray Help with trim! How many ActiveX processes can I have? Center text with PRINT Visual BASIC has encountered a problem ... ADODC control - form settings need help with how to format a cell in Excel with VB6 My screen stays on background |
|||||||||||||||||||||||