My code assumes you have a file named something like this.
C:\MyFolder\MyFileRev1.xls
Fpath returns the full path seen above.
My code initially looks for "Rev" in fpath
If you had a brand new file that didn't have Rev in the path you could check for that and name it Rev1 and bypass the rest of the code.
Then the newName line concatenates the 2 onto the original file name on the first loop. Dir checks if the file exists. With Dir if the file exists already it will return the file name, otherwise it returns "". So by checkingfor "" we confirm the file doesn't exist. revNumber will just keep changing until it finds the first rev number file that doesn't exist and once it does it saves the file and exits the loop.
Bookmarks