Modify file details

tonelm54
tonelm54 used Ask the Experts™
on
I'm trying to build a sub to modify the details of a file (lastModifiedTime, lastWriteTime, lastAccessedTime, createdTime), so I have been trying to build the following:-
	Sub setFileDateTime(strFolder, strFile, lastModifiedTime, lastWriteTime, lastAccessedTime, createdTime)
		Set objShell = CreateObject("Shell.Application")
		Set objFolder = objShell.NameSpace(strFolder)
		Set objFolderItem = objFolder.ParseName(strFile)
		
		objFolderItem.ModifyDate = lastModifiedTime
	End Sub

Open in new window


However I cannot find out how to access  lastWriteTime, lastAccessedTime, createdTime properties.

Any ideas?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
IT / Software Engineering Consultant
Top Expert 2016
Commented:
The properties are:

  • DateCreated Property
  • DateLastAccessed Property
  • DateLastModified Property

But I think you will find some or all of these are read only.

https://msdn.microsoft.com/en-us/library/1c87day3(v=vs.84).aspx

~bp

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial