Sequential days and dates starting from "start date" entered in form

I created a monthly calendar template (as the base for a daily planner) using the MS Word 2010 monthly calendar template and wish to add to the document by creating pages for each day of the month.  Using form fields, how can I sequentially insert the date for each daily page, using the  "start date" entered into the form?. For example, if I update the monthly calendar for "March 2013", the dates to be entered would be Friday, March 1, 2013, Saturday, March 2, 2013, Sunday, March 3, 2013, etc.  

 I read the document at http://www.gmayor.com/downloads.htm#Third_party multiple times and did not find the information needed.

Thank you in advance for any assistance offered.

 

Answer
Answer

If the Calendar that you mean is the 2012 Calendar Basic_one month evergreen, if you create a macro in your Normal.dotm template or in another template that you save in the Word Startup Folder and you start with a document that contains just the one page calendar.  when you run the macro, it will add a page for each day of the month to the calendar, inserting the date in the format that you want at the top of each page:

 

Sub AddPageperDay()

Dim i As Long
Dim rng As Range
With ActiveDocument
    .PageSetup.VerticalAlignment = wdAlignVerticalTop
    For i = 1 To Val(Format(.Variables("monthEnd"), "d"))
        .Range.InsertAfter Chr(12)
        Set rng = .Range
        rng.Collapse wdCollapseEnd
        .Fields.Add rng, wdFieldEmpty, "Docvariable MonthStart \@ MMMM"
        .Range.InsertAfter " " & i & ", "
        Set rng = .Range
        rng.Collapse wdCollapseEnd
        .Fields.Add rng, wdFieldEmpty, "Docvariable MonthStart \@ yyyy"
        .Range.InsertAfter vbCr
    Next i
    .Range.Fields.Update
End With

End Sub

Hope this helps,
Doug Robbins - MVP Office Apps & Services (Word)
dougrobbinsmvp@gmail.com
It's time to replace ‘Diversity, Equity & Inclusion’ with ‘Excellence, Opportunity & Civility’ - V Ramaswamy

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated October 5, 2021 Views 1,323 Applies to: