ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If file exists then (https://www.excelbanter.com/excel-programming/412416-if-file-exists-then.html)

Curt

If file exists then
 
Want to check if file exists zzz.xxx if true call a macro KillFile if not
exit
Blanked out
Thanks
If ("C:\Parade\zzz.txt") Then
Call KillFile
Exit Sub
' Else
End If

Rick Rothstein \(MVP - VB\)[_2096_]

If file exists then
 
If Len(Dir("C:\Parade\zzz.txt")) 0 Then ' File exists

Rick


"Curt" wrote in message
...
Want to check if file exists zzz.xxx if true call a macro KillFile if not
exit
Blanked out
Thanks
If ("C:\Parade\zzz.txt") Then
Call KillFile
Exit Sub
' Else
End If



John Wilson

If file exists then
 
Curt,

Public Function FileExists(FileName as String) As Boolean
FileExists = Len(Dir(FileName))
End Function

If FileExists("C:\Parade\zzz.txt") Then
Call KillFile
Exit Sub
Else
'Whatever
End If

HTH,
John

"Curt" wrote in message
...
Want to check if file exists zzz.xxx if true call a macro KillFile if not
exit
Blanked out
Thanks
If ("C:\Parade\zzz.txt") Then
Call KillFile
Exit Sub
' Else
End If




All times are GMT +1. The time now is 02:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com