In Soviet Russia, MS Word Dates You!
May 17, 2006 7:22 PM   Subscribe

I have a file in Word with a header that consists of a date, centered. Is there any way I can add 29 pages to the document to make a total of 30, dated " Thursday, June 1, 2006" - "Friday, June 30, 2006"? It seems like some sort of mail-mergy voodoo might work.

I'd really like to be able to have the newly created files as additional pages in my document, so that I can edit them independently. How do I do this?
posted by rossination to Computers & Internet (6 answers total)
 
Yes, the only way I can think of to do it "automatically" would be to put the dates in an access database and merge it in as a field within the document. However, by this point it just makes sense to manually type all the dates in.

There's probably some hidden Microsoft word function to which I'm not privy, however, and I claim ignorance on this one.
posted by allthewhile at 8:51 PM on May 17, 2006


I'm sure it wouldn't be very hard to write a macro that would do this for you, but, considering that we're only talking about 30 pages here, it's probably no easier than it would be to just copy, paste, and change.
posted by cerebus19 at 8:58 PM on May 17, 2006


Response by poster: Well, it's the kind of thing that we'd be re-doing every month, so a macro solution would be nice. How would I go about creating me one of them?
posted by rossination at 9:58 PM on May 17, 2006


Why not just create the dates in Excel (type first date, drag down 30 cells) then just cut and paste?
posted by AmbroseChapel at 11:47 PM on May 17, 2006


Best answer: Try the following subroutine; stick it in a module in your document template by hitting Alt-F11 from Word. In the VB Editor, on the left side of the screen, right-click your document template name (e.g., Normal) and select Insert -> Module. Then in the window on the right side of the screen, paste the following code:

' *************************
' START CODE

Public Sub subDatePages()
Dim dStartDate As Date
Dim nCount As Long
Dim dRawDate As Date
Dim nMonth As Long, nYear As Long

dStartDate = InputBox("Enter starting date")
Documents.Add DocumentType:=wdNewBlankDocument

nMonth = Format(dStartDate, "m")
nYear = Format(dStartDate, "yyyy")
For nCount = 1 To Format$(Day(DateSerial(nYear, nMonth + 1, 0)))
dRawDate = CDate(nMonth & "/" & nCount & "/" & nYear)
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.TypeText Text:=Format(dRawDate, "mmmm dd, yyyy")
Selection.InsertBreak Type:=wdPageBreak
Next nCount

End Sub

' END CODE
' *************************

Close the VB editor and save the template. Now any time you want to create this document, hit Tools -> Macro -> Macros, then highlight subDatePages and click Run.

Hope this helps.
posted by Doofus Magoo at 4:45 AM on May 18, 2006 [1 favorite]


Response by poster: Wow, thanks Doofus. I wish that you had an email in your newly created profile, so that I could thank you properly.
posted by rossination at 4:32 PM on May 18, 2006


« Older Advice for a first-time manager?   |   Why does my eyelid twitch when I ingest lots of... Newer »
This thread is closed to new comments.