I wrote a longer solution based on @musbach answer. I was only able to do this after reading his code. Thank you. P.S., I don't know why my code won't paste properly; I seem to always have this problem. :-(
Function datSetFileDateTime(stFullFilePath As String, datNew As Date) As Date ' ' Requires reference to shell32.dll, scrrun.dll ' Dim oShell As Shell Dim oFolder2 As Folder2 Dim stPath As String Dim fle As Scripting.File Dim stDrive As String Dim stPathWithoutDrive As String
Set oShell = New Shell
Set fle = vfso.GetFile(stFullFilePath) ' vfso is a global object for scripting.FileSystemObject that I create a load time.
stDrive = fle.Drive
Set oFolder2 = oShell.nameSpace(stDrive)
If (Not oFolder2 Is Nothing) Then
Dim oFolderItem As FolderItem
Set oFolderItem = oFolder2.ParseName(Mid(stFullFilePath, Len("c:\") + 1)) ' Need to remove drive name for ParseName
If (Not oFolderItem Is Nothing) Then
Dim szReturn As String
szReturn = oFolderItem.ModifyDate
oFolderItem.ModifyDate = CStr(datNew)
Else
'FolderItem object returned nothing.
End If
Set oFolderItem = Nothing
Else
'Folder object returned nothing.
End If
Set oFolder2 = Nothing
Set oShell = Nothing
datSetFileDateTime = vfso.GetFile(stFullFilePath).DateLastModified
End Function