Results 1 to 2 of 2
  1. #1
    5 Star Lounger Lou Sander's Avatar
    Join Date
    Jun 2002
    Pittsburgh, USA
    Thanked 11 Times in 10 Posts

    Improving a Date Stamp macro that I got from the Lounge

    THIS THREAD describes two slick little Date Stamp macros that I use for keeping track of things for my physician. The code, created by macropod, appears in Post #6.

    The first one puts a specially-formatted Date Stamp into my Word 2010 document when I execute it. I typically do that at the start of a paragraph. The second macro goes through my document and inserts some text stating how many days ago each Date Stamp was created. I've put icons for them on my Quick Access Toolbar, so it's pretty easy to use them.

    I've used the pair for several months now, and they are very useful to me and to the doctor. I'd like to make the following improvements, but coding them is beyond my skill level:

    Once a Date Stamp is over 89 days old, I'd like the second macro to express the elapsed time in integral months, rather than days. I'm not fussy about precision here... if it has been anything between 90 days and 119 days, expressing it as "3 months" would be fine. If anybody wants a more precise indication of elapsed time, they can just look at the original Date Stamp and do the calculations.

    There's something else I'd like to do, too. Whenever the second macro is executed, I'd like to put an indication in the document as to the date it was executed. That would let people know the "ago" in "45 days ago", "8 months ago", etc.

    I haven't figured out where I want to put that information, or in what format. I just know it would be great to include it. I imagine I'd do something to set it up the first time the "days ago" macro is executed, then update it when that macro is used later.
    Last edited by Lou Sander; 2016-06-16 at 16:05.
    Lou Sander
    Pittsburgh, Pennsylvania

  2. #2
    Super Moderator macropod's Avatar
    Join Date
    May 2002
    Canberra, Australian Capital Territory, Australia
    Thanked 470 Times in 387 Posts
    .InsertAfter " (" & Int(Now - CDate(.Text)) & " days ago)"
        If DateDiff("m", CDate(.Text), Now) > 2 Then
          .InsertAfter " (" & DateDiff("m", CDate(.Text), Now) & " months ago)"
          .InsertAfter " (" & Int(Now - CDate(.Text)) & " days ago)"
        End If

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

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