Does custom document property exist

  • Thread starter Thread starter XP
  • Start date Start date
X

XP

Using Office 2003 on Win XP;

I need a function I can call that checks to see if a custom document
property exists; if not add it with a token string entry...

If anyone can post a generic example it would be most appreciated.
 
Function CustomPropValue(prop As String)
Dim propValue As Variant

On Error Resume Next
propValue = ActiveWorkbook.CustomDocumentProperties(prop)
On Error GoTo 0
If IsEmpty(propValue) Then

propValue = "Initial"
ActiveWorkbook.CustomDocumentProperties.Add _
Name:=prop, _
LinkToContent:=False, _
Type:=msoPropertyTypeString, _
Value:=propValue
End If

CustomPropValue = propValue
End Function


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

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