Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    378
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Wayward custom document property

    Hi

    I have a macro that includes the following code:
    ActiveDocument.CustomDocumentProperties("HoursMon1 ") = Val(txtHoursMon1)

    txtHoursMon1 is a variable picked up from a form. It has a value of 6.5.

    HoursMon1 is a NUMERIC custom property, already defined.

    When the line is executed, HoursMon1 takes the value of 6 (rather than 6.5, as expected).

    Any ideas?
    Dale

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Wayward custom document property

    It sounds like your HoursMon1 is declared as an Integer. Can you define it as
    Dim HoursMon1 as Double
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    378
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Wayward custom document property

    I'm not sure what you mean, Andrew.

    txtHoursMon1 (the variable on the right) is defined in a form, and is therefore a string (I think).

  4. #4
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Wayward custom document property

    Can you define the custom property as a String? Does it positively have to be a numeric? If you define it as text then the full number goes in quite happily.

    The code is not simply truncating the number as 12.7 goes in as 13. It sure looks like a bug
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    378
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Wayward custom document property

    I told you not to tell me this is a bug!!!

    Ah well, I'll redefine it as Text, as you suggest. Mr Gates sure has a lot to answer for.

    Thanks for your help
    Dale

  6. #6
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Wayward custom document property

    Hi,

    What I've found, in Word 2000 SR-1, is that if you initially define the custom value as number, but put in an integer, it thinks it's an integer from then on. But if you give it an initial value wit a decimal point, it will hold a value with a decimal point later. You can even add a value of "0." when you define it initially, and it will handle decimals OK later.

    To be safe, you could delete then re-add the custom value instead of just updating it.
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  7. #7
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    378
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Wayward custom document property

    Thanks, Geoff

    I gave it a try in Word97, but it didn't work. So I've ended up using Andrew's suggestion of redefining the custom property as Text. This meant more work, but it's worked.

    Thanks to you both
    Dale

Posting Permissions

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