Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Sep 2001
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Existing CustomDocumentProperties (VBA - Word)

    Is there a way to test if a custom document property such as the following example exists?
    CustomDocumentProperties("Publication Number")

    I've tried the Exists method but to no avail. Any help?!? Thanks!

  2. #2
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    1,294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Existing CustomDocumentProperties (VBA - Word)

    HI ya
    I have the following code - use it & that will work.
    Diana

    'to call function to see if custom doc property exists.
    If DocPropertyExists("PublicationNumber") = TrueThen
    'enter your code here
    End If


    Function DocPropertyExists(sDocProperty$) As Boolean
    Dim dpThis As DocumentProperty
    For Each dpThis In ActiveDocument.CustomDocumentProperties
    If UCase(sDocProperty) = UCase(dpThis.Name) Then
    DocPropertyExists = True
    Exit For
    End If
    Next

    End Function

  3. #3
    New Lounger
    Join Date
    Sep 2001
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Existing CustomDocumentProperties (VBA - Word)

    Perfect!!! Thanks much!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •