Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Nov 2002
    London, Gtr London, England
    Thanked 0 Times in 0 Posts

    Word Constants and Values (Word 2003)

    Dear Loungers,

    Can anyone explain this for me...

    There are Word constants such as the document properties, and these include the custom properties which are of data type Single.
    Therefore the constant ActiveDocument.CustomDocumentProperties("DocCatego ry") will return a type 4 reflecting it's type of Single.
    BUT this property holds a value that is a string e.g. "Proposal" and I know that on a vb form I can do this:
    DocCategory = ActiveDocument.CustomDocumentProperties("DocCatego ry").Value (assuming DocCategory is the form control and a text box) this, in my example, would set the value shown in the DocCategory field to "Proposal", and it does.

    This is backed up if I test ActiveDocument.CustomDocumentProperties("DocCatego ry") for type and value I get 4 and "Proposal" respectively....

    BUT how does this work - how can an item defined as Single hold a value that is a string? or do I have the wrong end of the stick here?

    ...does this mean that form vields are somehow converting everything to variants or... my head hurts and I'm sure it's causing some fog that means I can't quite see where my thinking is flawed!

    if you can, thanks for helping..................... liz

  2. #2
    New Lounger
    Join Date
    Jul 2007
    Thanked 0 Times in 0 Posts

    Re: Word Constants and Values (Word 2003)

    Hi Liz,

    I don't think the "4" means that the custom document property is a Single.

    There is a built-in Enum (an enumerated type) called "msoDocProperties" which defines the possible type values for custom document properties.

    Each of the possible values has an associated number and the number for a string custom property happens to be 4.

    In the VBE open the object browser and search for "msoDocProperties" and you'll be able to see the members of the Enum, and (at the bottom of the screen) the number associated with each member.



Posting Permissions

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