how can i change year on event planner template

L

lynduc

I have a really good template from MS called Event Schedule Planner 2009 but
want to change it to 2010. When I change the year on the heading, the 12
month calendar below doesn't change . How can I change that, other than
importing a calendar? The problem is that the project phases won't work (I
think) if I insert a 2010 calendar. Will the dates I choose automatically
change with the new calendar I insert?
 
G

Graham Mayor

The planner template is but a basic document template. It is not macro
driven and it could be a bit of a pain to make it so. There is no
correlation between the dates and the calendar. You can open the template
and edit the year and the dates in the calendar. The following macro will
insert the new dates in each monthly calendar. Put the cursor in the cell
that represents the first of the month and run the macro. Repeat for each
month.

It runs slowly, but it will change the numbers that follow for that month
(though not those before the start position or after the end position) to
reflect the correct day/date and clears the background shading. Not perfect,
but should be accurate ... but slow :(

Sub Macro1()
Dim i As Long
Dim iDays As Long
Dim oRng As Range
iDays = InputBox("Days in the month")
For i = 1 To iDays
Set oRng = Selection.Cells(1).Range
oRng.Shading.BackgroundPatternColor = wdColorAutomatic
oRng.End = oRng.End - 1
oRng.Text = i
Application.ScreenRefresh
Selection.MoveRight Unit:=wdCell
Next i
End Sub

http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Graham Mayor

Just for the hell of it I have been playing around with the macro I posted
yesterday. The changes still don't make a silk purse out of the sow's ear
that is the template, but they do take some of the thinking away. If you
change the year at the top of the document to whatever year you wish, and
then put your cursor in the cell that represents the first day of each month
of the year in turn, then run the following, it will determine the month and
calculate the number of days in that month (including leap years). Clears
any existing numbers and background fills then renumbers the month. There
doesn't seem to be much you can do to speed up the fill given the way the
tables in the template have been nested, but at least you can watch the
progress - and it is much quicker than filling by hand!

Dim i As Long
Dim iDays As Long
Dim oRng As Range
Dim oMonth As Range
Dim oYear As Range
Set oYear = ActiveDocument.Tables(1).Cell(1, 1).Range
oYear.End = oYear.End - 1
oYear.Start = oYear.End - 4
Set oMonth = Selection.Tables(1).Cell(1, 1).Range
oMonth.End = oMonth.End - 1
Select Case LCase(oMonth.Text)
Case Is = "april", "june", "september", "november"
iDays = 30
Case Is = "january", "march", "may", "july"
iDays = 31
Case Is = "august", "october", "december"
iDays = 31
Case Is = "february"
If Month(DateSerial(oYear, 2, 29)) = 2 Then
iDays = 29
Else
iDays = 28
End If
End Select
Selection.Bookmarks.Add "StartCell"
For i = 3 To 8
Selection.Tables(1).Rows(i).Range.Select
Selection.Shading.BackgroundPatternColor = wdColorAutomatic
Selection.Delete
Next i
Selection.GoTo What:=wdGoToBookmark, name:="StartCell"
For i = 1 To iDays
Set oRng = Selection.Cells(1).Range
oRng.End = oRng.End - 1
oRng.Text = i
Application.ScreenRefresh
Selection.MoveRight Unit:=wdCell
Next i


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Joined
Dec 22, 2010
Messages
16
Reaction score
0
The planner template is a basic document template. It is not macro
driven and it could be a bit of a pain to make it so. There is no
correlation between the dates and the calendar. You can open the template
and edit the year and the dates in the calendar. The following macro will
insert the new dates in each monthly calendar. Put the cursor in the cell
that represents the first of the month and run the macro. Repeat for each
month.

It runs slowly, but it will change the numbers that follow for that month
(though not those before the start position or after the end position) to
reflect the correct day/date and clears the background shading. Not perfect,
but should be accurate ... but slow :(

Sub Macro1()
Dim i As Long
Dim iDays As Long
Dim oRng As Range
iDays = InputBox("Days in the month")
For i = 1 To iDays
Set oRng = Selection.Cells(1).Range
oRng.Shading.BackgroundPatternColor = wdColorAutomatic
oRng.End = oRng.End - 1
oRng.Text = i
Application.ScreenRefresh
Selection.MoveRight Unit:=wdCell
Next i
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top