I have a script (that I got from this group, thank you for this) that
creats an Excel file from my an SQL statement. The problem is if the file
already exists, it errors off. I would like to do just a 'blind' delete of
the file so the Create doesn't error off. Is there a way delete a file in
VBScript?

Thanks

Chris

Re: Delete A File Using VBScript? by Michael

Michael
Sun Jul 27 19:29:30 CDT 2003

You will find this in the script here
http://cwashington.netreach.net/depo/view.asp?Index=764&ScriptType=vbscript

Set oFSO = createobject("scripting.filesystemobject")

<...>

'// Move the lead file to the archive folder
'// Need to handle duplicate file names in this
If (fileExists("D:\avv\Archives\" & sFN)) then
oFSO.deletefile ("D:\avv\Archives\" & sFN)
End If

<...>

--
Regards,

Michael Holzemer
No email replies please - reply in newsgroup

Learn script faster by searching here
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/default.asp


"Chris Moore" <chris@dblayoutdotcom> wrote in message
news:Xns93C5C4E37DD12cabubba@207.46.248.16...
> I have a script (that I got from this group, thank you for this) that
> creats an Excel file from my an SQL statement. The problem is if the file
> already exists, it errors off. I would like to do just a 'blind' delete of
> the file so the Create doesn't error off. Is there a way delete a file in
> VBScript?
>
> Thanks
>
> Chris



Re: Delete A File Using VBScript? by Chris

Chris
Mon Jul 28 08:32:01 CDT 2003

Thanks, that did it. I also noticed your link to the TechNet Script
center, Great resource. Thanks for that also.

Chris



"Michael Holzemer" <ms2kguru@noway.pacbell.net> wrote in
news:#xYlQ9JVDHA.2112@TK2MSFTNGP10.phx.gbl:

> You will find this in the script here
> http://cwashington.netreach.net/depo/view.asp?Index=764&ScriptType=vbsc
> ript
>
> Set oFSO = createobject("scripting.filesystemobject")
>
> <...>
>
> '// Move the lead file to the archive folder
> '// Need to handle duplicate file names in this
> If (fileExists("D:\avv\Archives\" & sFN)) then
> oFSO.deletefile ("D:\avv\Archives\" & sFN)
> End If
>
> <...>
>