View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Does custom document property exist

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)



"XP" wrote in message
...
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.