Harry Covair
Member
Hello forum,
I want to manipulate image files by transferring them to another folder and changing the name. See the code used.
The problem is that on the instruction "ModifiedDate_MyFile MyFile.DateLastModified =" VBA responds with a message "Invalid Procedure".
Could a member of the forum help me to solve this problem.
Thank you in advance for your answers.
Harry
I want to manipulate image files by transferring them to another folder and changing the name. See the code used.
The problem is that on the instruction "ModifiedDate_MyFile MyFile.DateLastModified =" VBA responds with a message "Invalid Procedure".
Could a member of the forum help me to solve this problem.
Thank you in advance for your answers.
Harry
Code:
Sub ChangeFileName()
Dim MyFile As String, OldPath As String, NewPath As String
Dim OldName As String, NewName As String
Dim ModifiedDate_MyFile As Date
OldPath = "C:\Users\XX\Documents\YY 2015\"
NewPath = "C:\Users\XX\Documents\YY\2015_03_02\"
MyFile = Dir(OldPath & "DSC*.jpg")
Do While Len(MyFile) > 0
OldName = OldPath & MyFile
ModifiedDate_MyFile = MyFile.DateLastModified
NewName = NewPath & " 20150302 " & MyFile
Name OldName As NewName
Loop
End Sub