Displaying Document Properties in Excel

A

AlwaysFroosh!

This should be pretty straight forward, but I can't find it for the life of
me. I have a document with a bunch of properties, and I want these properties
to be displayed in certain cells on my spreadsheet. What formula can I use to
retrieve the document property??
Thanks
 
B

Bob Phillips

'-----------------------------------------------------------------
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")


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
G

Gord Dibben

First off.........save a backup of your workbook.

Then use this User Defined Function

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

'=DOCPROPS("last author")
'or
'=DOCPROPS("last save time")
'or
'DOCPROPS("creation date")

For a list of other properties that may be available(not all are), run this
macro.

Sub props()
rw = 1
Worksheets.Add
For Each p In ActiveWorkbook.BuiltinDocumentProperties
Cells(rw, 1).Value = p.Name
rw = rw + 1
Next
End Sub


If not familiar with VBA and macros, see David McRitchie's site for more on
"getting started".

http://www.mvps.org/dmcritchie/excel/getstarted.htm

In the meantime..........

To create a General Module, hit ALT + F11 to open the Visual Basic Editor.

Hit CRTL + R to open Project Explorer.

Find your workbook/project and select it.

Right-click and Insert>Module. Paste the above code in there. Save the
workbook and hit ALT + Q to return to Excel window.

Enter the formula as shown above.


Gord Dibben Excel MVP

This should be pretty straight forward, but I can't find it for the life of
me. I have a document with a bunch of properties, and I want these properties
to be displayed in certain cells on my spreadsheet. What formula can I use to
retrieve the document property??
Thanks

Gord Dibben MS Excel MVP
 
Top