On 10/22/2010 03:25 AM, Greg wrote:
Hi, I am using scripting to get the time and date off some pictures.
I am having a problem the date/time properties missing the seconds
component. Formation the data as hh:mm:ss does not help.
Using windows 7, excel 2010
Will this work in xl2010?
http://msdn.microsoft.com/en-us/libr...ffice.10).aspx
Get Quick Access to File Properties by Using the VBA File Functions
You can quickly obtain file properties such as the created date, the
last modified date, or the number of bytes in a file by using the VBA
FileDateTime and FileLen functions, for example:
Public Sub TestFileProperties()
' Purpose: Demonstrates the use of the VBA FileDateTime
' and FileLen functions.
' Create the following file in your C:\ drive.
Const FILE_PATH As String = "C:\SampleFile.txt"
On Error GoTo TestFileProperties_Err
' List the created/modified date and the number of bytes
' for the file.
MsgBox Prompt:="'" & FILE_PATH & "' was created or last " & _
"modified on " & FileDateTime(pathname:=FILE_PATH) & "."
MsgBox Prompt:="'" & FILE_PATH & "' contains " & _
FileLen(pathname:=FILE_PATH) & " bytes."
TestFileProperties_End:
Exit Sub
TestFileProperties_Err:
Select Case Err.Number
Case 53 ' File not found.
MsgBox Prompt:="Can't find file '" & FILE_PATH & "'. " & _
"Check the file path and try again."
Case Else
MsgBox "Error number: " & Err.Number & vbCrLf & _
"Description: " & Err.Description
End Select
Resume TestFileProperties_End
End Sub