Microsoft Office Tutorials and References
In Depth Information
Using Calendar Wizard
'All rows same height, to fill page¶
tbl.Rows.HeightRule = wdRowHeightExactly¶
With doc.PageSetup¶
tbl.Rows.Height = _¶
((.PageHeight - .TopMargin - .BottomMargin) _¶
/ nrRows)¶
End With¶
'Enter days of the week in top row¶
For Each cel In tbl.Rows(1).Cells¶
counter = counter + 1¶
cel.Range.text = Format(weekDay(counter), "dddd")¶
Next cel¶
Set InsertCalendarTable = tbl¶
End Function¶
' * * * * *¶
Sub FillCalendar(tbl As Word.Table, dat As Date)¶
'Variable declaration¶
Dim startWeekDay As Long¶
Dim nrDays As Long¶
Dim monthName As String¶
Dim nrRows As Long¶
Dim nrCols As Long¶
Dim cel As Word.Cell¶
Dim ffld As Word.FormField¶
Dim counter As Long¶
nrRows = tbl.Rows.Count¶
nrCols = tbl.Columns.Count¶
startWeekDay = weekDay(dat)¶
'Calculate the number of days in the specified month¶
nrDays = DateDiff("d", dat, DateAdd("m", 1, dat))¶
monthName = Format(dat, "MMMM") & " " & _¶
Format(dat, "yyyy")¶
'Start in the cell corresponding to first¶
'weekday of the specified month¶
tbl.Rows(2).Cells(startWeekDay).Select¶
'Number the days of the month and¶
'insert a formfield for text entry¶
For counter = 1 To nrDays¶
With Selection¶
.Collapse wdCollapseStart¶
.Font.Bold = True¶
.TypeText counter¶
.Font.Bold = False¶
'New line¶
.TypeText Chr$(11)¶
Set ffld = .FormFields.Add( _¶
Range:=.Range, Type:=wdFieldFormTextInput)¶
ffld.name = Format(DateAdd("d", (counter - 1), _¶
dat), "MMM_DD_YYYY")¶
.Cells(1).Range.Next(wdCell, 1).Select¶
End With¶
Wrd
Search JabSto ::




Custom Search