
Signature
It's not when, but How .....
Peter,
If I follow you, you want to enter a date (e.g., 19 January 2005) on
the top of one page and on following pages have 26 January 2005, then
02 February 2005. Is this correct?
Here is a method that you could use. Run this macro:
Sub DateSeq()
Dim myDate As Date
Dim seqNum As Long
Dim seqLength As Long
Dim seqInt As Long
Dim upSeq As Long
Dim i As Long
Dim dateFormat As String
Retry:
On Error GoTo Oops
myDate = InputBox("Enter the start date in 1/01/2005 format.", _
"Start On", Date)
On Error GoTo 0
seqLength = InputBox("Enter the sequence length e.g., 14.", _
"Sequence Length", "14")
dateFormat = InputBox("Enter the format for the date display e.g." _
& "dddd, mmm dd yyyy.", "Date Format", "mmmm dd, yyyy")
seqInt = InputBox("Enter the sequence interval in days.", "Interval",
"1")
For seqNum = 1 To seqLength
upSeq = seqNum * seqInt
ActiveDocument.Variables("Var" & seqNum).Value = _
Format(myDate + upSeq - seqInt, dateFormat)
Next
ActiveDocument.Fields.Update
Exit Sub
Oops:
If Err.Number = 13 Then
If myDate = "12:00:00 AM" Then Exit Sub
If MsgBox("Invalid format! Start date must be in 1/31/2005 format",
_
vbRetryCancel, "Alert") = vbRetry Then
Resume Retry
End If
Resume Next
End If
End Sub
For and example, use 12 as the sequence length and 7 as the interval.
This will create 12 docvarialbes storing the sequenced dates.
Place the following field in your document in each place that you want
a sequenced date to appear.
{ DocVariable{ Quote Var{ Seq Date }}
Note all { } pairs are entered with CTRL+F9. Once you enter one field
you can copy and paste to the other locations. Use CTRL+a and F9 to
update and display the field results.
Hope this helps.
Peter Verhey - 20 Jan 2005 09:51 GMT
Hello Greg,
Thank you for your tip, I'll hope it will work, only when I run it in Word97
I'll get an compile error on de Sub DateSeq() ..
DO you know by any chance what this can be?
Thank you very much.
Peter Verhey
> Peter,
>
[quoted text clipped - 56 lines]
>
> Hope this helps.
Greg Maxey - 20 Jan 2005 10:32 GMT
Peter,
The compile errror is probably due to the unfortunate result of pasting
working code in a newsgroup screen that wraps the text differently than it
should be. You will need to try to identify what line in the code is
causing the comipile errror and fix it. Does a line or lines appear in red?
That is the spot that will need work and it is likely due to the line being
broken in the wrong place.

Signature
Greg Maxey/Word MVP
A Peer in Peer to Peer Support
> Hello Greg,
>
[quoted text clipped - 69 lines]
>>
>> Hope this helps.
Peter Verhey - 20 Jan 2005 10:43 GMT
I've already solved it...It works great..Thanks Greg..
> Hello Greg,
>
[quoted text clipped - 67 lines]
> >
> > Hope this helps.