I want to add a space in between a document name. However the code can't pass through the IF True line.
Document name having random name as below:
INV500TAT1234 Rev 1 Form_Health.pdf
Wanted it to be:
INV500 TAT1234 Rev 1 Form_Health.pdf #with a space in between 500 & TAT
Note that some of the document does already contain INV500 TAT, so I wrote the if to skip them
Sub Rename_Space()
Dim ffile As Variant, path As String
path = "C:\Users\me\Desktop\Rename\"
ffile = Dir(path)
While ffile <> ""
If ffile = "INV500TAT*" Then
old_name = path & ffile
new_name = path & "INV500 TAT*"
Name old_name As new_name
End If
ffile = Dir
Wend
End Sub