ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Does custom document property exist (https://www.excelbanter.com/excel-programming/407016-does-custom-document-property-exist.html)

XP

Does custom document property exist
 
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.


Bob Phillips

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.





All times are GMT +1. The time now is 07:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com