Solved

Add one day to a field code date

Posted on 2007-11-13
3
2,683 Views
Last Modified: 2008-11-04
I have the following field code: {TIME  \@ "MMMM d, yyyy" }

How can I add one day to this date?  I am always creating a letter the night before and would like to have the next days date on the letter that I will be mailing out the letter.

Thank you.
0
Comment
Question by:thandel
  • 2
3 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 250 total points
ID: 20278430
I would say No. It is too difficult. There is no in-built date arithmetic in Word Fields, so you have to calculate when the day rolls over to the next month and the next year.

However, there are some brave people who do that sort of thing:

This site has a zipped Word document that you can download with many date calculations
http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=249902.

Look for the field under "Calculate a day, date, month and year, using n days delay". Use the Alt + F9 toggle to see/hide the field codes. You can copy and paste it into your document, but we can only paste the result into here. It is pre-set to 14 days hence, so you need to edit that to a 1 when the code is visible. Don't forget that fields need to be updated to perform their calculation.

Note that it comprises an outer field with 32 other fields nested at various depths within it.


Personally, I would have a simple macro like this:

Sub Tomorrow()
    Selection.Text = Format$(DateAdd("d", 1, Now), "Long Date")
End Sub

and set up a keystroke shortcut (Tools/Customize) to insert it.
0
 

Author Comment

by:thandel
ID: 20296523
Instead of a key stroke could I some how have your macro run or insert into a bookmark when the document opens?
0
 

Author Comment

by:thandel
ID: 20296536
Nevermind, I use the date calculations word file... very impressive!
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Do you ever need to create a 20 page Word document for some testing purpose? Are you tired of copying & pasting old boring "lorem ipsum" text over and over again, increasing font size and line space in order to make the document 20+ pages long? Look…
The Selection object is designed for user interaction. It has a Range property, so it can be used in most places that a Range object can. Recorded macros must use the Selection because they are simply copying what the user is doing. A Range prope…
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question