How to extract the file date and insert it into table

  • Thread starter Thread starter 3@work
  • Start date Start date
3@work said:
Dear all

How to extract the file date (photo taken date for DC) into a table.

I'm not sure what exactly you want, but if you have the path to the file
in a string variable or text box, you can use the FileDateTime function
to return the last-modified date of that file into a date/time field or
variable.
 
Another option will be

Dim oFSO As Object
Dim oF As Object

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oF = oFSO.GetFile("D:\My folder\File.TXT")
Debug.Print F.DateCreated
Debug.Print F.DateLastModified

Set oF = Nothing
Set oFSO = Nothing
 
Ofer said:
Another option will be

Dim oFSO As Object
Dim oF As Object

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oF = oFSO.GetFile("D:\My folder\File.TXT")
Debug.Print F.DateCreated
Debug.Print F.DateLastModified

Set oF = Nothing
Set oFSO = Nothing

That's a good suggestion, if one needs the created-date, as distinct
from the last-modified date. I don't think I'd want to incur the
overhead of creating a FileSystemObject if all that's wanted is the the
last-modified date, since that's available via a built-in VBA function.
 
Do you want:

1 the date the file was created
2 the date the file was last modified
3 the date in file's "Date Picture Taken" property
4 the date the picture was actually taken?

1 and 2 can be retrieved as shown elsewhere in this thread.

For 3, you need to dig into the EXIF (or DCF) properties which modern
digital cameras include in their files. There's some code here
http://sourceforge.net/projects/exifclass/ which can probably be used or
adapted for VBA, or you may find something by googling.

Finally, there's no guarantee that any of 1,2 and 3 is the same as 4!
 
Back
Top