Hello
I have problem with this code !
the code will search for words sales reports if theses words are existed , then will add dd mmm yyyy based on modified date , but the problem will adddd mmm yyyy continously when run the macro evry time even if the file name contains sales reports dd mmm yyyy shouldn't do that . if there is already file contains sales reports dd mmm yyyy then should ignore it .
Sub Test()
Dim p$, f$, pf$, d$, x$, n$
p = "E:\" 'change to your path
f = Dir(p & "*sales reports*")
Do While f <> vbNullString
pf = p & f
d = UCase(Format(FileDateTime(pf), "dd mmm yyyy"))
x = Right(pf, Len(pf) - InStrRev(pf, ".") + 1)
n = Left(f, Len(f) - Len(x))
If Not Right(n, 11) Like "## ??? ####" Then
n = n & " " & d & x
Name pf As p & n
End If
f = Dir
Loop
End Sub
thanks