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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete Excel Files

Status
Not open for further replies.

Rzrbkpk

Technical User
Mar 24, 2004
84
0
0
US
I want to delete Excel files in a folder using an Access VB module. I tried the same method that I used for searching for files (fs), but when I use the deletefile method, it doesn't work. Any ideas? Do I perhaps not have the library referenced that I need for this code? Thanks.
 
How about this....

Assuming you know the file name and path.
Dim FileName
FileName = "c:\My Documents\Junk.xls"
Kill FileName



Randy
 
Code:
Function Delete_Files(PathName)
    Dim ds
    Set ds = CreateObject("Scripting.FileSystemObject")
    
    ds.DeleteFile PathName
     
End Function

Mike
 
Code:
Function Delete_Files(PathName)

    Dim ds
    Set ds = CreateObject("Scripting.FileSystemObject")
    
    ds.DeleteFile PathName
     
End Function

Good Luck

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top