D
Dallman Ross
Is there a way for an Excel formula to know the date stamp of
a file?
Thanks,
Dallman
a file?
Thanks,
Dallman
Bob Phillips said:'-----------------------------------------------------------------
Function DocProps(prop As String)
'-----------------------------------------------------------------
Application.Volatile
On Error GoTo err_value
DocProps = ActiveWorkbook.BuiltinDocumentProperties _
(prop)
Exit Function
err_value:
DocProps = CVErr(xlErrValue)
End Function
and enter in a cell such as
=DocProps ("last author")
or
=DocProps ("last save time")
Documents\Records\Finance\Securities\Statements\2006\SB 2006 UnrealizedDallman Ross said:In <[email protected]>, Dallman Ross <dman@localhost.> spake thusly:
Okay, I did find this:
http://www.cpearson.com/excel/docprop.htm
And I downloaded DSO Version 2.0 from Microsoft as indicated on the
page and installed it. But I'm a bit lost as to how to get the
code snippet to work. Is it still a function? I have this
now --
Dim FileName As String
Dim DSO As DSOFile.OleDocumentProperties
Set DSO = New DSOFile.OleDocumentProperties
FileName = "E:\My
Bob Phillips said:You need to create a sub, or a function and add it there. These
go into a standard code module, Insert>Module in the VBIDE.
Whether it is a sub or a function depends upon how you want to
get the results.
Bob Phillips said:I have created an example file and posted it
http://cjoint.com/?jrwjpeuDeb
Open the Excel workbook, and then run the macro 'GetDateCreated'.
Tom Ogilvy said:Since it is for a CSV file, don't you just want the file Data and
time you would see in Windows Explorer?
Function DocProp(s as String)
'Application.Volatile
if Dir(s) <> "" then
DocProp = FileDateTime(s)
else
DocProp = "File Doesn't exist"
End Function
go to the vbe, Alt+F11, do Insert module, put in the above
usage
=DocProp("E:\My Documents\Records\Finance\Securities\Statements\2006\SB 2006
Unrealized Gains, Trading.csv")
Uncomment Application.Volatile if you think the CSV file will be changing
frequently.
Tom Ogilvy said:I would guess that non-office files don't have the extended
properties offered by the compound document format.
You can also play with the scripting runtime: This isn't set up as a
worksheet function.
Steve Yandl said:For even more extended file properties, you can use the
"Shell.Application" object. Here is an example in vbs that can
easily be incorporated in a VBA routine:
http://www.microsoft.com/technet/scriptcenter/guide/sas_fil_lunl.mspx?mfr=true