How can I generate successive dates in Word?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am writing a document that will containing daily readings. I want to
insert a field before each reading that will automatically insert the next
date. Thanks.
 
Probably the easiest way is to use mailmerge with a data source in an Excel
spreadsheet where it is easy to create a column of dates.

Alternatively, see if Macropod has something at:

www.wopr.com/cgi-bin/w3t/showt­hreaded.pl?Number=249902

Or, every time you run the following macro, it will insert the date,
incremented by one day each time, at the location of hte cursor:

If System.PrivateProfileString("c:\Settings.txt", "MacroSettings", _
"MyDate") = "" Then
Selection.InsertBefore Format(Date, "d MMMM yyyy")
System.PrivateProfileString("C:\Settings.txt", "MacroSettings", _
"MyDate") = Format(DateAdd("d", 1, Date), "d MMMM yyyy")
Else
Selection.InsertBefore System.PrivateProfileString("c:\Settings.txt", _
"MacroSettings", "MyDate")
System.PrivateProfileString("C:\Settings.txt", "MacroSettings", _
"MyDate") = Format(DateAdd("d", 1,
System.PrivateProfileString("C:\Settings.txt", _
"MacroSettings", "MyDate")), "d MMMM yyyy")
End If
Selection.Collapse wdCollapseEnd



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
Back
Top