Page 3 of 7 FirstFirst 12345 ... LastLast
Results 31 to 45 of 92
  1. #31
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    190
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Date Calculations in Word (2.20)

    Edited by Phil Rabichow to make the link clickable - see Help #19
    Hi Macropod,

    Thanks for your great document. I mentioned in in reply to a question on the Tek-Tips Microsoft Office Forum and received immediate responses re the quality of your work. Here is the thread if you would like to see the feedback:

    http://www.tek-tips.com/viewthread.cfm?SQI...D=68&page=3

    Once again great work!

    Regards,
    Peter Moran
    Melbourne!

  2. #32
    Star Lounger
    Join Date
    Feb 2002
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Calculations in Word (2.20)

    Yes, I take your point about macro protection. I have indeed loked at the field codes and they are understandable! I never realised you could put soft returns in a field - that makes them far more comprehensible. A fantastic piece of work - is there a URL where the general public can download the document?

  3. #33
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,879
    Thanks
    0
    Thanked 183 Times in 168 Posts

    Re: Date Calculations in Word (2.20)

    Hi Tim,
    Re:
    <hr>is there a URL where the general public can download the document?<hr>
    Anyone can do that right here, at: http://www.wopr.com/cgi-bin/w3t/showflat.p...d&Number=249902
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  4. #34
    New Lounger
    Join Date
    Mar 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Calculations in Word (2.20)

    Are there any known bugs with the "Calculate a day, date, month and year, using n days delay" field ?

    I attempted to calculate the date 90 days from today (March 14, 2004). The result , Monday 6 December 2004, is incorrect. I then tried to calculate the date 70 days from now. The result , Sunday May 23 2004, is correct.
    Further "trial and error" revealed that the field calculation is incorrect for the following delays:
    Delay =18 to 29 (April 1-12)
    Delay = 48 to 59 (May 1-12)
    Delay = 79 to 90 (June 1-12)

    It appears that the algorithm has trouble calculating any date which falls in the first 12 days of future months.

    Any feedback would be appreciated.

    Regards,
    kleveck

  5. #35
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,879
    Thanks
    0
    Thanked 183 Times in 168 Posts

    Re: Date Calculations in Word (2.20)

    Hi kleveck,

    I've just re-tested the field and it is working correctly. The clue to your problem is in the output format you've specified in your (edited) post. The fields in the document are region-dependent and are coded to work on systems that are configured to display dates formatted as d/MM/yyyy (short form) or dddd, d MMMM yyyy (long form). Something I'll need to note in the next update. Your 'issue' relates to a system that is configured to display dates formatted as MM/d/yyyy (short form) or dddd, MMMM d yyyy (long form). To obtain the correctly result is as simple as changing the expression 'dd*10^6+mm*10^4+yy' to 'mm*10^6+dd*10^4+yy'. Adding the appropriate date switch will then display the result accordingly.

    Cheers
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  6. #36
    New Lounger
    Join Date
    Mar 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Calculations in Word (2.20)

    Macropod,
    Thanks for your quick response. Yes, the issue was resolved by changing the date format expression per your instructions.

    <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23>

    Regards,
    kleveck

  7. #37
    New Lounger
    Join Date
    May 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Calculations in Word (2.25)

    Like, WOW!! I have already put to use the function to put in yesterday's date in a document - thanks. I thought I was a clever bunny a dozen years ago discovering "* ordinal" but all this just blows me away!! (BTW I've come here via Tek-Tips Forum). The answer is probably out there but what I need is to be able to determine what today's Day of the Week is and then adjust the print field accordingly. I haven't decided which way to do it but I have this Run Sheet that we report one day's activity on the next day. We do this each day. For the weekend I will either print it on Friday with the field forward to Monday or visa versa, but I also want it to be used for every other day of the week as well. Can anyone help, please?

  8. #38
    New Lounger
    Join Date
    May 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Calculations in Word (2.25)

    Thanx. This is all VERY new to me after years of VBA. What I meant was at the moment we have a 'Backup Log' sheet and you'd normally write today's date in against 'Date' and then the appropriate date against 'Backup Date', e.g. today I wrote Date: Thursday 20th May, Backup Date: 19 May 2004. (Yes, I know the format is different - but hey, so am I!). What we have at present is a stack of pre-printed forms. If we were to print them off for daily use, would we want to print them off on the day or the previous day? So, if we print them on the day, today would come out as shown above. If we printed them the night before then today it would show Date: Friday 21st May 2004, Backup date: 20 May 2004. Similarly, printing on the day, I'd want Monday to come out as Date: Monday 24th May 2004, Backup Date 21 May 2004. If I chose the advance method I'd want to get the same result if I were printing it on the Friday, i.e. the delay would be + or - and the trigger day would be different. Sorry if I muddied the water a bit with the original comment but I thought it worth putting in in case it made a difference (no idea what) to the solution.

    I've just tried the modified formula and it's showing Wednesday, 20 May 2004. Cool. This stuff just looks SO weird though! I was thinking about printing in advance because we have to print off a Daily Runsheet in advance.

    I've been playing around trying to get it to be 'forward thinking' and have got it to show Friday now by removing the initial -. I've changed my system date to Friday so the field now says Saturday. I've tried a bunch of things but can't get the hang of what is the Day Of Week.

    Des.

  9. #39
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,879
    Thanks
    0
    Thanked 183 Times in 168 Posts

    Re: Date Calculations in Word (2.25)

    Hi Des,

    To revert the date to Friday for a report printed on Saturday, Sunday or Monday, and to revert by one day in any other case, take the field in "Changing document dates during the course of a day" on page 4 and change the Delay formula to:
    =-1-(MOD(jd,7)=6)-(MOD(jd,7)=0)*2

    I'm not quite sure though what you mean by<blockquote><hr>For the weekend I will either print it on Friday with the field forward to Monday or visa versa<hr></blockquote> Can you explain this a bit more?

    Cheers
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  10. #40
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,879
    Thanks
    0
    Thanked 183 Times in 168 Posts

    Re: Date Calculations in Word (2.25)

    Hi Des,

    See if the attached does what you want. It's based on the interactive date calculator from page 4, plus the superscripted ordinal day numbering demo from page 1and the delay formula from my previous post. This allows you to nominate the report day (with today's date being given as the default), then calculates the weekday prior to that for the Backup date, reproducing the second version of your date formats along the way (though I can't really tell wether your ordinals were meant to be superscripted).

    Cheers
    PS: This could, of course, all be done with vba ...
    Attached Files Attached Files
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  11. #41
    New Lounger
    Join Date
    May 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Calculations in Word (2.25)

    Thanx. I'd really like to understand what the * - and / actually do, I'm used to multiply, subtract and divide from XL formulae. Is it possible to work things out? I think what I want to end up with is printing today for the next working day. I'm happy enough with the current field for the backup Date - Friday 21st May 2004 - I just need to work out how to jump forward 1 day for Monday thru Thursday and to jump forward 3 days if today is Friday; all without using VBA!!

    Des.

  12. #42
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,879
    Thanks
    0
    Thanked 183 Times in 168 Posts

    Re: Date Calculations in Word (2.25)

    Hi Des,

    The * and / perform multiplications and divisions, respectively. For more information on doing maths with Word fields, see <post#=365442>post 365442</post#>.

    Most of the fields for calculating date offsets in the document use a gregorian calendar date to julian day number conversion, followed by addition of the required offset, then a julian day number to gregorian calendar date conversion. Hence the convoluted maths.

    To 'jump forward' by one day requires 1 to be added to the date's julian day number. To test the day of the week, you can use MOD(julian day number,7). For Fridays, this returns 4 (error in the doco), which you can use to trigger a 3-day delay.

    So, for Monday thru Thursday you'll want to use a delay of 1 and on Fridays you'll want to use a delay of 3. There are various ways to code this, depending on what you want to achieve. For example:
    {SET Delay{=(MOD(jd,7)<4)+(MOD(jd,7)=4)*3}}, which ignores Saturday (MOD(jd,7)=5) & Sunday (MOD(jd,7)=6)
    or
    {SET Delay{=1+(MOD(jd,7)=4)*2}}, which adds 1 for Saturday & Sunday also
    or
    {SET Delay{=1+(MOD(jd,7)>3)*(6-MOD(jd,7))}}, which is functionally equivalent to {SET Delay{=1+(MOD(jd,7)=4)*2+(MOD(jd,7)=5)}} and skips to Monday for Fridays thru Sunday.

    Cheers
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  13. #43
    New Lounger
    Join Date
    May 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Calculations in Word (2.30)

    Hi all, sorry for the newbie post - I'm sure with more hours(?!) of hacking macropod's examples around, I'd stumble on the solution but I'm finding this msword field stuff a real struggle.

    I'm trying to convert a third-party date field from a CRM package into a nicely formatted date with ordinal.

    The CRM uses plain text in the doc like [# Schedule Date#] which it replaces with a date in the format dd/mm/yyyy (including forward-slashes).

    I'd like to end up with the "Long Date" format (which incidentally I don't seem to be having much luck with even after checking my regional settings! - however dddd, d MMMM yyyy seems to work ok)

    So, could someone PLEASE help me to convert the format "31/05/2004" into something more presentable such as "Monday, 31st May 2004"?

    Many thanks in anticipation!

  14. #44
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,879
    Thanks
    0
    Thanked 183 Times in 168 Posts

    Re: Date Calculations in Word (2.30)

    Hi Calito,

    Assuming (always risky) that your CRM package uses a 'proper' date field, you should be able to display it via Shift-F9. If so, it will look something like:
    {DATE}
    In that case, substituting that field with one from the very first example in the Date Calc document will deliver the output in a format close to what you're after. If you edit the field code from the first such example to look like:
    {QUOTE{DATE @ dddd}", "{DATE @ "d" *Ordinal}" "{DATE @ "MMMM yyyy"}}
    you'll get an output that exactly matches the one you're after.

    If your CRM package inserts the date in plain text, you'll need some means of putting that text string into a field for processing. For example, if you had a field coded as:
    {QUOTE{SET DtString "[# Schedule Date#]"}{DtString @ dddd}", "{DtString @ "d" *Ordinal}" "{DtString @ "MMMM yyyy"}}
    and could get your CRM package to replace the [# Schedule Date#] string with a date, that could be used to achieve the desired result. Alternatively, you might use a macro in the Word document to move the plain [# Schedule Date#] string into the field for processing. Once you've gone that far, though, you may as well use the same macro to do all the processing and simply replace the [# Schedule Date#] string with the required output.

    Of course, the 'best' approach might be to see if your CRM package can insert the date in the required format without having to do any post-insertion processing in Word.

    Cheers
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  15. #45
    New Lounger
    Join Date
    May 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Calculations in Word (2.30)

    Many thanks for the reply. The latter of the options is true - CRM program uses plain text entry in my 'template' and replaces it with the date set in my calendar.

    The second example worked in that the date string "5/06/2004" was inserted correctly into the field code. However, pressing Alt-F9 to show the result produced nothing... Not sure if this is a problem with my OS/Word setup or not?

    Have attached the doc in question. Would appreciate if you could take a look and see what you think?

    Thanks again!
    Attached Files Attached Files

Page 3 of 7 FirstFirst 12345 ... LastLast

Posting Permissions

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