Hi tfilipe
Replace the line beginning fname with this :
The code at the bottom should hunt out and delete the oldest file in the directory that your workbook sits in.
The bit that you didn't follow : You will need to start with three backup files in this directory. The code will always delete the oldest file. If you don't start with three backup files, then the current one will always be deleted, and you will end up with no backup files. If you have three backup files to start with, your macro will create a fourth, my code will delete the oldest, and you are left with the most recent three. See?
This code will delete the file - it won't be put into a recycle bin. It will be gone. Do not test this on your live files until you are happy that it works as you expect.
At the moment, the "Kill" command at the bottom is commented out, so the code will tell you what the oldest file is. To make it live, uncomment the "Kill" line and remove the "MsgBox" line.
HTH
DominicB
Bookmarks