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

How to delete a file using VB

Status
Not open for further replies.

jmgs98

MIS
May 10, 2004
9
0
0
MX
I need to validate the existance of a excel file..if exist i need to delte it.

Please, any suggestions?

Thanks!
 
Check out my FAQ:

faq222-3657

Swi
 
Private Sub Command1_Click()
If FileExistsDIR("C:\Test.xls") Then Kill "C:\Test.xls"
End Sub

' Method 1
Function FileExistsDIR(sFile As String) As Boolean
FileExistsDIR = True
If Dir$(sFile) = vbNullString Then FileExistsDIR = False
End Function

Swi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top