Results 1 to 8 of 8

Thread: Word Date Code

  1. #1
    New Lounger
    Join Date
    Mar 2002
    Location
    Jacksonville, Florida, USA
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Word Date Code

    I need to print labels with a modified julian date code.

    I have the formula for Excel
    =RIGHT(YEAR(A1),2) & TEXT((A1-DATE(YEAR(A1),1,0)),

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word Date Code

    The following works in Word VBA:

    <pre>Dim sJDate As String
    sJDate = Right(Year(Date), 2) & Right("000" & CStr(Date - DateSerial(Year(Date), 1, 0)), 3)
    </pre>


    I can't see a way to do it using Word fields.
    Legare Coleman

  3. #3
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word Date Code

    (snip!)

    Thanks

  4. #4
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,049
    Thanks
    124
    Thanked 119 Times in 116 Posts

    Re: Word Date Code

    I have your field. <img src=/S/bow.gif border=0 alt=bow width=15 height=15> For today's date it produces 01088.

    I am attaching a document containing the fields needed.

    Note that this will produce the wrong result in the last 10 months of the following years: 2100,2200,2300,2400,2500,2600,2700,2800, and 2900 because they are divisible by 4 but not leap years.
    Charles Kyle Kenyon
    Madison, Wisconsin

  5. #5
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,049
    Thanks
    124
    Thanked 119 Times in 116 Posts

    Re: Word Date Code

    <img src=/S/shy.gif border=0 alt=shy width=15 height=15>Oops!

    The document I attached had a mistake due to my improperly copying a bookmark. Somehow the bookmark "NumberOfDays" became attached to all three fields. It should only surround the last (big) field. It is used to add the "0" placeholder if the number of days is only two digits.

    If someone needs the corrected version, I can email it. I hate to use up board space with another copy.
    Charles Kyle Kenyon
    Madison, Wisconsin

  6. #6
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,049
    Thanks
    124
    Thanked 119 Times in 116 Posts

    Re: Word Date Code

    And you wondered how I managed to make so many posts. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    It looks to me like the attachment never went through, so here is the (corrected) version. Any further updates or corrections will be available from <A target="_blank" HREF=http://www.addbalance.com/word/download/index.htm>my download page</A> (www.addbalance.com/word/download/)
    Attached Files Attached Files
    Charles Kyle Kenyon
    Madison, Wisconsin

  7. #7
    New Lounger
    Join Date
    Mar 2002
    Location
    Jacksonville, Florida, USA
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word Date Code

    Thanks Charles! It only took two years for someone to come up with a method. Clearly a better crowd here at Woody's than CNet!!!

    Thanks again!

    Mark

  8. #8
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: Word Date Code

    Charles,

    Aren't 2400, 2800 leap years? Years ending in 00 are not leap years unless the century is also divisible by 4.

    So the formula is not as far off as you thought. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    Fred

Posting Permissions

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