View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone[_2_] Jim Cone[_2_] is offline
external usenet poster
 
Posts: 1,549
Default Check if a File Exists

Sub WhatAmIDoing()
If IsItThere("C:\Parade\zzz.txt") Then
Call KillFile
Exit Sub
Else
'do something
End If
'more somethings
End Sub

Function IsItThere(ByRef strPath As String) As Boolean
Dim blnFile As Boolean
blnFile = Len(Dir(strPath))
IsItThere = blnFile
End Function
--
Jim Cone
Portland, Oregon USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




"Curt"
wrote in message
If ("C:\Parade\zzz.txt") Then
Call KillFile
exit sub
' Else
End If
Missing something Want if file exists call KillFile if not by pass and
continue



"Jim Cone" wrote:
Function IsItThere()
Dim blnFile As Boolean
Dim strPath As String

strPath = "C:\Program Files\ahead\Nero\Boo.wav"
blnFile = Len(Dir(strPath))
MsgBox blnFile
End Function
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware




"Ray Clark"
wrote in message
I need to check if a file exists before creating a new file.