I'm not sure if this function is good practice or not, but I use it
VB Code:
If FileExists(App.Path & "\filename") Then Kill (App.Path & "\filename") Private Function FileExists(ByVal File As String) As Boolean Dim fLen As Integer On Error Resume Next fLen = Len(Dir$(File)) If Err Or fLen = 0 Then FileExists = False Else FileExists = True End If End Function
Only use App.Path if you want to search for the file where your exe resides. Obviously ByVal or ByRef is a choice you will make.





Reply With Quote