You need to create a sub, or a function and add it there. These go into a
standard code module, InsertModule in the VBIDE.
Whether it is a sub or a function depends upon how you want to get the
results.
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
"Dallman Ross" <dman@localhost. wrote in message
...
In , 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
Documents\Records\Finance\Securities\Statements\20 06\SB 2006 Unrealized
Gains, Trading.csv"
DSO.Open sfilename:=FileName
Debug.Print DSO.SummaryProperties.DateCreated
DSO.Close
I'm not sure how to put that into the VBA area, i.e., what to call it,
how to access it, etc. Basically, I'm pretty confused about where
to put the above and how to get the result into a cell in Excel.
Dallman
In , Bob Phillips
spake thusly:
'-----------------------------------------------------------------
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")
That's very nice! However, I want it to be for a different file,
not the active workbook. E.g.,
"E:\My Documents\Records\Finance\Securities\Statements\20 06\SB 2006
Unrealized Gains, Trading.csv"
(which is also a data source for one of the open worksheets, in case
that helps).