Home All Groups Group Topic Archive Search About
Author
8 Mar 2006 6:57 AM
Roger Stenson
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

Author
8 Mar 2006 7:14 AM
NickHK
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
>
>