Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-19-2011, 05:22 PM
terry795 terry795 is offline How do I get auto-updated "number of days since specified date" on MS word? Windows XP How do I get auto-updated "number of days since specified date" on MS word? Office 2003
Novice
How do I get auto-updated "number of days since specified date" on MS word?
 
Join Date: Apr 2011
Posts: 6
terry795 is on a distinguished road
Default How do I get auto-updated "number of days since specified date" on MS word?


How do I get auto-updated "number of days since specified date" on MS word? In other words, I'd like to have this cell in my table autoupdate the interval of days between the date I specified and today's date. I know that there are several ways to do this. For example "fx=datedif(A1,today(),"d")" would work on Excel, but I am trying to find an alternative way.

MS visual basic? Found this online but don't know how to use it.
Sub dateFunctions4()
Debug.Print "The day part is: " & DatePart("d", Now)
End Sub

Macro's? Field codes? Help! Thanks.
Reply With Quote
  #2  
Old 04-19-2011, 08:05 PM
macropod's Avatar
macropod macropod is offline How do I get auto-updated "number of days since specified date" on MS word? Windows 7 32bit How do I get auto-updated "number of days since specified date" on MS word? Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Terry,

It can be done with either macros of field coding. Which would you prefer? If it's field coding, you'd simply insert the field where you want the output to appear. If it's macros, you need to be able to tell Word where to insert/update the date. Does the 'specified date' need updating and, if so, is that to be done via, say, a FILLIN field, a bookmarked range, or a macro's inputbox?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 04-19-2011, 08:27 PM
macropod's Avatar
macropod macropod is offline How do I get auto-updated "number of days since specified date" on MS word? Windows 7 32bit How do I get auto-updated "number of days since specified date" on MS word? Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I see you've cross-posted this at: http://answers.microsoft.com/en-us/o...c-68b599b31bf5
where you've already been pointed to a tutorial I wrote on the use of field coding for this. That may or may not meet your needs - which is why I asked for further info before pointing you in that direction.

For cross-posting etiquette, please see: http://www.excelguru.ca/node/7
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
Old 04-19-2011, 08:33 PM
terry795 terry795 is offline How do I get auto-updated "number of days since specified date" on MS word? Windows XP How do I get auto-updated "number of days since specified date" on MS word? Office 2003
Novice
How do I get auto-updated "number of days since specified date" on MS word?
 
Join Date: Apr 2011
Posts: 6
terry795 is on a distinguished road
Default

Hi macropod,

Thanks for the response! Let me give you a better idea of what I'm trying to do. This is for a surgery patient list on MS Word. We want to be able to enter an operation date in one cell of a table and then have the number of days since that date (post-operative day # or POD#) in another cell. So to answer your question, the specified date would not be changed.

If I used field codes, then I'd have to make each operation date for each patient a bookmark and refer to it in the code for the POD#? I'd like to make this more user-friendly for other medical students like myself. Would a macro require less work?

Thanks again!
Reply With Quote
  #5  
Old 04-19-2011, 09:02 PM
terry795 terry795 is offline How do I get auto-updated "number of days since specified date" on MS word? Windows XP How do I get auto-updated "number of days since specified date" on MS word? Office 2003
Novice
How do I get auto-updated "number of days since specified date" on MS word?
 
Join Date: Apr 2011
Posts: 6
terry795 is on a distinguished road
Default

I am very sorry, I rarely ever post on forums or boards. I wasn't expecting a response any time soon and thought that maybe posting on more than 1 would give me a better chance of getting one. Thanks for the etiquette link though.

I read the relevant portion of your tutorial (very well-written, btw). Is there a way to make it more user-friendly for other people to enter specified dates?
Reply With Quote
  #6  
Old 04-19-2011, 10:06 PM
macropod's Avatar
macropod macropod is offline How do I get auto-updated "number of days since specified date" on MS word? Windows 7 32bit How do I get auto-updated "number of days since specified date" on MS word? Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Terry,

In that case, you'll need a macro-based solution. See attached. There's a 'Document Open' macro in it that automatically updates the first table in the document, which is assumed to have four coulms:
• Patient name
• Operation date
• Post-Op days elapsed
• Discharge date
If you input a date in column 2 (Operation date) column 3 (Post-Op days elapsed) will be updated next time you open the document. Inputting a date in column 4 (Discharge date) will stop column 3's value updating beyond that date. Changing column 4's value will cause the column 3's value to be re-assessed.
Attached Files
File Type: doc PatientRecords.doc (38.5 KB, 92 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 04-22-2011, 01:28 PM
terry795 terry795 is offline How do I get auto-updated "number of days since specified date" on MS word? Windows XP How do I get auto-updated "number of days since specified date" on MS word? Office 2003
Novice
How do I get auto-updated "number of days since specified date" on MS word?
 
Join Date: Apr 2011
Posts: 6
terry795 is on a distinguished road
Default

I really can't thank you enough!

We actually don't need a discharge date column, although that was a very nice gesture. Our other columns are "procedure, antibiotics and to-do", but I think I can add that myself. I attached a snipping of it to this post. How do I rid of the discharge date column?

I think I'm going to read up on Visual Basic coding this weekend. It would be extremely helpful if you would explain how your macro works. I'm sure my resident will ask me to explain how he could incorporate this at the different hospitals he's going to be working at.

Thanks again! You're awesome.
Attached Images
File Type: jpg Pt list ex.jpg (38.0 KB, 62 views)
Reply With Quote
  #8  
Old 04-22-2011, 02:28 PM
macropod's Avatar
macropod macropod is offline How do I get auto-updated "number of days since specified date" on MS word? Windows 7 32bit How do I get auto-updated "number of days since specified date" on MS word? Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Terry,

If you don't have a discharge date column or something equivalent, every count in the Post-Op days elapsed column will keep updating forever! So how's it supposed to know when to stop updating the count?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 04-22-2011, 03:15 PM
terry795 terry795 is offline How do I get auto-updated "number of days since specified date" on MS word? Windows XP How do I get auto-updated "number of days since specified date" on MS word? Office 2003
Novice
How do I get auto-updated "number of days since specified date" on MS word?
 
Join Date: Apr 2011
Posts: 6
terry795 is on a distinguished road
Default

Oh, I forgot to mention that these aren't permanent records. It's a list for us to keep track of our patients currently in the hospital. We delete the patient's row once they are discharged.
Reply With Quote
  #10  
Old 04-22-2011, 03:34 PM
macropod's Avatar
macropod macropod is offline How do I get auto-updated "number of days since specified date" on MS word? Windows 7 32bit How do I get auto-updated "number of days since specified date" on MS word? Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Terry,

That makes a big difference! Try the attached - I'll let you take care of the formatting.
Attached Files
File Type: doc PatientRecords.doc (45.0 KB, 107 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #11  
Old 04-22-2011, 03:55 PM
terry795 terry795 is offline How do I get auto-updated "number of days since specified date" on MS word? Windows XP How do I get auto-updated "number of days since specified date" on MS word? Office 2003
Novice
How do I get auto-updated "number of days since specified date" on MS word?
 
Join Date: Apr 2011
Posts: 6
terry795 is on a distinguished road
Default

Thank you so much! *thumbs up*
Reply With Quote
  #12  
Old 01-07-2016, 08:06 AM
Subi84 Subi84 is offline How do I get auto-updated "number of days since specified date" on MS word? Windows 7 64bit How do I get auto-updated "number of days since specified date" on MS word? Office 2013
Novice
 
Join Date: Jan 2016
Posts: 3
Subi84 is on a distinguished road
Default

This is great. Can you explain how it works so I can use it in other report formats that I have? i've downloaded the file you provided with the table but it doesn appear to have any fields or macros. Thanks!

Last edited by Subi84; 01-07-2016 at 08:10 AM. Reason: clarify question...
Reply With Quote
  #13  
Old 01-07-2016, 09:29 AM
Charles Kenyon Charles Kenyon is offline How do I get auto-updated "number of days since specified date" on MS word? Windows 8 How do I get auto-updated "number of days since specified date" on MS word? Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,125
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

The tutorial explains how these work. Pay special attention to the first part on the construction and use of fields. The tutorial is full of sample fields.
Reply With Quote
  #14  
Old 01-07-2016, 12:02 PM
Subi84 Subi84 is offline How do I get auto-updated "number of days since specified date" on MS word? Windows 7 64bit How do I get auto-updated "number of days since specified date" on MS word? Office 2013
Novice
 
Join Date: Jan 2016
Posts: 3
Subi84 is on a distinguished road
Default

Yeah...thanks Charles but I already tried that. I may as well be reading hieroglyphs....
Reply With Quote
  #15  
Old 01-07-2016, 03:31 PM
macropod's Avatar
macropod macropod is offline How do I get auto-updated "number of days since specified date" on MS word? Windows 7 64bit How do I get auto-updated "number of days since specified date" on MS word? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Subi84 View Post
Can you explain how it works so I can use it in other report formats that I have? i've downloaded the file you provided with the table but it doesn appear to have any fields or macros.
The documents do indeed contain macros. They're Document_Open macros that you can't see via Alt-F8; instead you can access them via Word's VB Editor, which you can open via Alt-F11.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Wierd symbols inplace of "space", "indentation" etc aka.bhagvanji Word 5 02-16-2012 11:50 AM
How do I get auto-updated "number of days since specified date" on MS word? Is there a way to make the cross-refernce format to be "Only lable and number"? Jamal NUMAN Word 1 04-10-2011 03:31 PM
Creating an Auto-Calc'd Date? Today+7 Days? SoCalTelephone Word 0 10-06-2010 10:27 AM
in WORD, how do i type a 9-digit phone number "xxxxxxxxx" and have it automatically.. jay8962 Word 0 04-08-2010 11:08 AM
"Microsoft Excel Application" missing in the "Component Services" on win08 sword.fish Excel 0 02-26-2010 02:09 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:11 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft