Hi

Could someon take a look at my code for renaming files
for the source of a Listbox.
-------------------------------------------------------
Private Sub Command1_Click()
On Error GoTo Correction

Dim Oldname
Dim Newname

For i = 0 To List1.ListCount
Oldname = Dir1.Path & "\" & File1.List(i)
Newname = Dir1.Path & "\" & List1.List(i)
Name Oldname As Newname
Next i

File1.Refresh

Exit Sub
Correction:
MsgBox ("File alredy exits, or file in use"), _
vbCritical, "File Protection!!"

Exit Sub
error:
MsgBox ("The amount of titles do not mach the number of files to be renamed"), _
vbCritical, "Hello, Wake Up"

End Sub
---------------------------------------------------------

I get an error message "File alredy exits, or file in use"
but still the files are renamed.

Any clues?

Hope you can help

Best regards,

Chris Davidsen