Return an Alternative FileName if a Given File Exists

Category:
Files and Directories
Type:
Snippets
Difficulty:
Beginning
Author:
Derrick Q. Chun

Version Compatibility: Visual Basic 6

More information:
This function uses FileSystemObject to determine if a file name has already been used. If so, it'll add a letter on the file name to return a new file name.

It's very useful when you need to make sure you don't accidentally overwrite an existing file as you try to copy or create a new file.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: