Re: :ต้องการ rename file in folder:
Posted: Mon Oct 30, 2017 3:54 pm
แบบนี้ได้ไหมครับ
ผมใส่ "\" เข้าไปช่วย

ผมใส่ "\" เข้าไปช่วย
Code: Select all
Sub DoSomething()
Dim rAll As Range
Dim r As Range
With Sheets("List")
Set rAll = .Range("A2", .Range("A" & Rows.Count).End(xlUp))
End With
For Each r In rAll
MyPath = r.Value
MyFile = r.Offset(0, 1).Value
NewName = r.Offset(0, 2).Value
If Dir(MyPath & "\" & MyFile) <> "" Then
Name MyPath & "\" & MyFile As MyPath & "\" & NewName
End If
Next r
End Sub