J
Jan Kronsell
Hi NG
Im trying to rename/move all files in a directory using
Sub nytfors()
Set fs = Application.FileSearch
With fs
.LookIn = "C:\tb"
.Filename = "*.jpg"
End With
For i = 1 To fs.FoundFiles.Count
OldName = "C:\tb\" & fs.FoundFiles(i)
NewName = "C:\tb2\u" & i
'Debug.Print OldName, NewName
Name OldName As NewName
Next i
End Sub
but the code stops at
Name OldName As NewName
telling me its an invalid procedure call or argument.
Any ideas?
Jan
Im trying to rename/move all files in a directory using
Sub nytfors()
Set fs = Application.FileSearch
With fs
.LookIn = "C:\tb"
.Filename = "*.jpg"
End With
For i = 1 To fs.FoundFiles.Count
OldName = "C:\tb\" & fs.FoundFiles(i)
NewName = "C:\tb2\u" & i
'Debug.Print OldName, NewName
Name OldName As NewName
Next i
End Sub
but the code stops at
Name OldName As NewName
telling me its an invalid procedure call or argument.
Any ideas?
Jan