Ok, so here is what I need to do. I have a folder with 8 avi files in it. Files are named 1.avi, 2.avi...etc. I want to rename those files so that file 1.avi will be a random file in the folder. I also want to be able to add files with the same naming convention and have it rename as many files as I put in there. So basically I just want to scramble the files in the folder.
I thought maybe having a table with the filenames in a column and then a random number column. It would just rename the filename to the random number. But I can't figure it out.
This is the code I found that I have been messing with:
Private Sub Command0_Click()
Const FILEPATH As String = _
Dim strfile As String
Dim filenum As String
strfile = Dir(FILEPATH)
Do While strfile <> ""
If Right$(strfile, 3) = "avi" Then
filenum = Mid$(strfile, Len(strfile) - 6, 3)
Name FILEPATH & strfile As FILEPATH & filenum & ".avi"
strfile = Dir
But it gives me the old 'Filename already exists." error. Which makes sense. I just can't figure out how to do this. Thanks for any help you can give me on this. It is very puzzling.