How do I display custom file properties in a cell

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I can define custom file properties using File / Properties, but how do I
create a formula or similar in a cell to reference the custom file properties
?

eg. If I specify a custom file property called "Project" and give it a value
of "Project XXX", how can I get that value displayed in a worksheet cell ?

Thanks
 
Function CustomProps(prop As String)


On Error GoTo err_value
CustomProps = ActiveWorkbook.CustomDocumentProperties(prop)
Exit Function


err_value:
CustomProps = CVErr(xlErrValue)
End Function


and can be used like so


=-CustomProps("myProperty")


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
Hi Bob,

Thanks for your response. I am an intermediate user of Excel and I dont know
how to use VB. Can you help me a little further at all please ?

Many Thanks

Glen
 
Sure.

First, go to the VBIDE (Alt-F11)

Insert a new code module (Insert>Module)

Paste the code that I gave you in there.

Then go back to the Excel window and use it as shown

=CustomProps("Project")

--
HTH

Bob Phillips

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top