Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

delete xls file 4

Status
Not open for further replies.

scrappe7

Technical User
Jul 30, 2001
82
US
Hi I am looking for the the coding that would delete an xls file. My current macro opens some source data files then copys all the data to 1 file. i would like to then have those source files deleted. Is this possible? I knwo you can open and close xls files from excel but can you DELETE them as well?
 
Hi,
Here's a way to delete Excel file "C:\exa.xls"...
Code:
    Dim fs, f
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFile("C:\exa.xls")
    f.Delete
Hope it helps :) Skip,
metzgsk@voughtaircraft.com
 
A shorter version would be using Skips example file would be

kill "C:\exa.xls"
 
Pezamystik,

You've just proven... "there's ALWAYS another option",
and it appears yours is indeed preferable.

THANKS !!! ...and a STAR to you too.

Regards, ...Dale Watson dwatson@bsi.gov.mb.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top