Microsoft Office Tutorials and References
In Depth Information
Using Calendar Wizard
Next¶
'Enter month name bottom right¶
'Merge cells for "Notes", bottom left unless¶
'Month (except February) starts on Fri or Sat¶
'then the Notes space is top left¶
If (startWeekDay = 6 Or startWeekDay = 7) _¶
And (nrDays >= 30) Then¶
Set cel = tbl.Cell(2, 1)¶
MergeAndLabelCell cel, "Notes", "Notes: ", 2, 5¶
InsertFormFieldAtEndOfCell cel, "Notes"¶
Set cel = tbl.Cell(nrRows, 5)¶
MergeAndLabelCell cel, "Month", monthName, _¶
nrRows, nrCols¶
Else¶
Set cel = tbl.Cell(nrRows, 1)¶
MergeAndLabelCell cel, "Notes", "Notes: ", nrRows, 4¶
InsertFormFieldAtEndOfCell cel, "Notes"¶
Set cel = tbl.Cell(nrRows, 2)¶
MergeAndLabelCell cel, "Month", monthName, _¶
nrRows, cel.Range.Rows(1).Cells.Count¶
End If¶
End Sub¶
' * * * * *¶
Sub MergeAndLabelCell(ByVal cel As Word.Cell, _¶
Label As String, text As String, _¶
lastCellRow As Long, lastCellCol As Long)¶
cel.Merge mergeto:= _¶
cel.Range.Tables(1).Cell(lastCellRow, lastCellCol)¶
cel.Range.Bookmarks.Add name:=Label, Range:=cel.Range¶
cel.Range.text = text¶
End Sub¶
' * * * * *¶
Sub InsertFormFieldAtEndOfCell(cel As Word.Cell, _¶
name As String)¶
'Variable declaration¶
Dim rng As Word.Range¶
Dim ffld As Word.FormField¶
Set rng = cel.Range¶
rng.Collapse wdCollapseEnd¶
rng.MoveEnd wdCharacter, -1¶
Set ffld = rng.FormFields.Add(Range:=rng, _¶
Type:=wdFieldFormTextInput)¶
ffld.name = name¶
End Sub¶
' * * * * *¶
Sub FormatCalendar(tbl As Word.Table)¶
'Variable declaration¶
Dim rng As Word.Range¶
Dim counter As Long¶
Dim lastRow As Word.Row¶
Set rng = tbl.Range¶
Wrd
Search JabSto ::




Custom Search