Checking for Existence of a File

How do you check to see if the name of a file you want to RENAME a file to already exists?

Here is a great example of how to determine the existence of any file:

   Sub Command1_Click()      Dim TheFile as String      Dim Results as String      TheFile = "C:README.TXT"      Results = Dir$(TheFile)      If Results  = "" Then         MsgBox "File Doesn't Exist!"      Else         MsgBox "File does Exist!"      End If   End Sub
Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: