Thread: Rename Files
View Single Post
 
Old 05-14-2012, 03:03 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,363
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

It would have been easier if you had posted a workbook with sample data to begin with.

Try:
Code:
Sub RenameFiles()
Dim i As Long, Strpath As String
Strpath = "\\geodb-1\f\villages\"
With ActiveSheet
  On Error Resume Next
  For i = 1 To 12
    If Dir(Strpath & .Cells(i, 1).Value, vbNormal) <> "" Then
      Name Strpath & .Cells(i, 1).Value As Strpath & .Cells(i, 2).Value
    End If
  Next
End With
End Sub
Note: you may still have to change Strpath to use a conventional filepath, rather than the network path.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote