Hi mrice,
Thanks a lot for your reply, I tried to incorporate the code posted by you in the main macro but it's not working. Can you please let me know what is going wrong. Here is the modified code.
Code to Rename Files :
Sub RenameFiles()
Dim OldFileName As String
Dim NewFileName As String
For i = 1 To Range("A1").End(xlDown).Row
OldFileName = Cells(i, 1).Value = Dir(Cells(i, 1).Value)
NewFileName = Cells(i, 2).Value
If Not Dir(OldFileName) = "" Then Name OldFileName As NewFileName
Next
'For i = 1 To Range("A1").End(xlDown).Row
'OldFileName = Cells(R, 1).Value
'NewFileName = Cells(R, 2).Value
'If Not Dir(OldFileName) = "" Then Name OldFileName As NewFileName
'Next
End Sub
Code to list out directory files :
Sub DirList()
Dim myextn As String
myextn = InputBox("Enter the file Extension", "Enter Extension")
If myextn = "" Then Exit Sub
Const ListDir = "C:\Documents and Settings\D.Ramakant\Desktop\Msgs\New Folder\"
If Not Dir(ListDir & "*." & myextn) = "" Then
Flist = Dir(ListDir & "*." & myextn)
R = 1
Do Until Flist = ""
Cells(R, 1).Value = Flist
R = R + 1
Flist = Dir
Loop
End If
End Sub
Thanks a lot for your help in advance.
Bookmarks