PC Review


Reply
Thread Tools Rate Thread

Changing the Date/Time Stamp

 
 
Robin Clay
Guest
Posts: n/a
 
      5th Nov 2008
Now the clocks have gone back, and I forgot to change the time on my camera,
the time shown as the file creation date/time is now out by an hour.

How can I change this time in a VBA subroutine?

I have a routine wot does it, but this relies upon the presence and use of a
programme called "TOUCH.COM" that I don't have on this computer.

I had hoped that this line would work:-
Set f.DateLastModified = myTest2
....but it doesn't, so I resorted to creating a batch file.....

Here's the relevant part of the routine:-

Select Case DoWhat
Case Is = "ReName"
If NoDuplicate(LastRow, FirstRow, N, "B") _
And Len(Trim(Range("B" & N).Value)) > 0 Then
OldName = myFolderName & Range("A" & N).Value
If Len(Ext(NewName)) = 0 Then _
NewName = NewName & "." & Ext(OldName)
Name OldName As NewName
Else
Range("B" & N).Font.ColorIndex = 3
Range("B" & N).Font.Bold = True
myText = "We have a duplicate name !"
End If
Case Is = "ReDate"
NewDate = Range("D" & N).Value
For M = 1 To .FoundFiles.Count
myTest1 = FileNameAndExt(.FoundFiles(M))
myTest2 = Worksheets("Sheet1").Range("A" & N).Value
If myTest1 = myTest2 Then
Set f = FSO.GetFile(.FoundFiles(M))
If Worksheets("Sheet1").Range("D" & N).Value <> ""
Then
myTest1 = f.DateLastModified
myTest2 = Worksheets("Sheet1").Range("D" &
N).Value
myTest1 = "C:\Progra~1\Utilities\touch " & _
myShortPath(.FoundFiles(M)) & _
" /D:" & myWord(1, myTest2, " ")
& _
" /T:" & myWord(2, myTest2, " ")
' e.g. "C:\Program Files\Utilities\touch" 0891*.JPG
/D:26/02/2005 /T:15:04:00 /T:15:04:00
WriteThisToFile MyBatchFile, myTest1
'Set f.DateLastModified = myTest2
End If
M = .FoundFiles.Count
End If
Next M
Case Else
End Select



Regards

Robin
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing 2 files on date/time stamp, and based time difference do a subroutine info@stevik.nl Microsoft Excel Programming 1 28th Sep 2007 03:53 AM
Changing the time-stamp Jason Manwaring Microsoft Outlook Discussion 0 18th Sep 2007 05:10 PM
Saving codes source file date-time stamp for run-time use =?Utf-8?B?a2VuQG5vc3BhbS5ub3NwYW0=?= Microsoft Dot NET Framework 4 24th Jan 2005 05:32 PM
Best Date Stamp changing utility Frankie V. Fernandez, MD Windows XP General 0 4th Oct 2004 01:35 PM
Invalid date time stamp error every time winxp pro boots Harp Windows XP Setup 2 18th Jul 2004 07:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:23 PM.