#1
|
|||
|
|||
Date Field to add 10 Days to Current Date
I am using Microsoft Word 2007 and trying to find the code that will allow the creation of a date field to add 10 days to the current date. This document will be uploaded for many users to access, so it must also update this date automatically based upon the date the document is opened. I've used the DateCalc file located at http://www.gmayor.com/downloads.htm#Third_party which does seem to work for me, although it does not update automatically when opening the document from day to day. I physically have to highlight the field and right click Update Field to get the current date plus 10 days out. Is there any way to make this date field update automatically based on the date the document is opened? Or is there a different method to do this? Any help would greatly be appreciated. Thanks in advance. Mike |
#2
|
||||
|
||||
Hi Mike,
You could force the field to update upon opening via a Document_Open macro, but having such a macro may cause issues for your users - for security reasons, some may not have macros enabled and others may be unwilling to let a macro in a 'foreign' document run.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Unfortunately I cannot use macros in this document. Is there any other way to make the date automatically update? Or is it possible to create a date 10 days in advance from when the document is opened any other way? Maybe not using a field or a different code within the field?
Last edited by Erbwon; 11-09-2012 at 12:37 PM. |
#4
|
||||
|
||||
Sadly, there is no other way. Your users can set Word to update fields before printing, to ensure their printouts are updated, but there's nothing you can do at the document level without a macro to guarantee even that.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
How would I go about setting up the macro? And will all users need to habe macros enable for them to open the document correctly?
|
#6
|
||||
|
||||
Assuming the field is in the body of the document, the macro is nothing more than:
Code:
Private Sub Document_Open() ThisDocument.Fields.Update End Sub And yes, all users would need to have Word configured appropriately. For Word to be able to run macros, go to Word Options|Trust Centre>Trust Center Settings and select the 'Disable all macros with notification' option. That will cause Word to ask for permission before allowing macros in a document to run. This setting applies to all documents, except those opened from what Word 2007 & later call 'trusted publishers, 'trusted locations' and trusted documents' (none of which generate the prompt). The dialoge box that opens when you clicked on 'Trust Center Settings' has entries for these as well, but you probably don't need to worry about any of their settings.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
Thanks for your help, the macro worked perfectly on my end, I still need to test out the document after I upload it to confirm it works correctly for all my users.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Meaning of current date vs status date when saving baselines | ketanco | Project | 1 | 02-08-2012 02:20 PM |
Set calendar alarm x days before end date | el_ja | Outlook | 2 | 01-19-2012 10:09 AM |
30+ days Variable Day Date Calculations via Fields | ztag | Word | 2 | 01-06-2012 11:12 AM |
How to call current PC date and/or current PC year | KIM SOLIS | Excel | 2 | 11-04-2011 06:09 PM |
Creating an Auto-Calc'd Date? Today+7 Days? | SoCalTelephone | Word | 0 | 10-06-2010 10:27 AM |