Results 1 to 3 of 3
2016-06-16, 17:01 #1
- Join Date
- Jun 2002
- Pittsburgh, PA
- Thanked 10 Times in 9 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 17:05.Lou Sander
2016-06-16, 19:09 #2
- Join Date
- May 2002
- Canberra, Australian Capital Territory, Australia
- Thanked 417 Times in 346 Posts
.InsertAfter " (" & Int(Now - CDate(.Text)) & " days ago)"
If DateDiff("m", CDate(.Text), Now) > 2 Then .InsertAfter " (" & DateDiff("m", CDate(.Text), Now) & " months ago)" Else .InsertAfter " (" & Int(Now - CDate(.Text)) & " days ago)" End IfCheers,
[MS MVP - Word]
2016-06-17, 02:56 #3
- Join Date
- Dec 2009
- Thanked 986 Times in 916 Posts
Would it be better to have the "days ago" value auto update when you view the document?