Hi,
I've used the following code to test if a file exists before copying it to somewhere else but it keeps giving me an error saying.
"Expected end sub"
This is the code
Any ideas?
Cheers
I've used the following code to test if a file exists before copying it to somewhere else but it keeps giving me an error saying.
"Expected end sub"
This is the code
Code:
Private Sub CommandButton1_Click()
Function FileExists(FileName As String) As Boolean
FileThere = (Dir(FileName) > "")
End Function
If FileExists("C:\Archive.pst") Then
CommandButton1.Caption = "Please wait..."
CommandButton1.Enabled = False
CommandButton2.Enabled = False
FileCopy "C:\Archive.pst", "M:\email\Archive.pst"
Else
MsgBox "File not found!", vbOKOnly, "Error!"
End If
End Sub
Any ideas?
Cheers