This macro will return the value of a custom or built-in document property. If the property does not exist, and empty string is returned.
Public Function GetProperty(p As String)
Dim S As Variant
On Error Resume Next
S = ActiveWorkbook.CustomDocumentProperties(p)
If S <> "" Then
GetProperty = S
Exit Function
End If
On Error GoTo EndMacro
GetProperty = ActiveWorkbook.BuiltinDocumentProperties(p)
Exit Function
EndMacro:
GetProperty = ""
End Function
Public Function GetProperty(p As String)
Dim S As Variant
On Error Resume Next
S = ActiveWorkbook.CustomDocumentProperties(p)
If S <> "" Then
GetProperty = S
Exit Function
End If
On Error GoTo EndMacro
GetProperty = ActiveWorkbook.BuiltinDocumentProperties(p)
Exit Function
EndMacro:
GetProperty = ""
End Function
No comments:
Post a Comment