Microsoft Office Tutorials and References
In Depth Information
Using Calendar Wizard
'Number of points in a quarter inch¶
In1_4 = InchesToPoints(0.25)¶
'Reduce screen flicker¶
Application.ScreenUpdating = False¶
'Loop until the user has entered a valid date¶
Do¶
startDate = InputBox( _¶
"Enter the desired date in the form 'Month Year'." _¶
& vbCr & "Example: January 2005")¶
'The user clicked Cancel or didn't enter anything¶
If startDate = "" Then Exit Sub¶
Loop While Not IsDate(startDate)¶
dat = CVDate(startDate)¶
'Create new document; make page settings¶
Set doc = Documents.Add¶
With doc.PageSetup¶
.PaperSize = wdPaperLetter¶
.Orientation = wdOrientLandscape¶
.RightMargin = In1_4¶
.LeftMargin = In1_4¶
.TopMargin = In1_4¶
.BottomMargin = In1_4¶
End With¶
Set tbl = InsertCalendarTable(doc)¶
FillCalendar tbl, dat¶
FormatCalendar tbl¶
SetViewOptions doc¶
End Sub¶
' * * * * *¶
Function InsertCalendarTable(doc As Word.Document) _¶
As Word.Table¶
'Variable declaration¶
Dim tbl As Word.Table¶
Dim cel As Word.Cell¶
Dim nrRows As Long¶
Dim nrCols As Long¶
Dim counter As Long¶
'Row 1: weekdays; rows 2-6 each week in the month¶
'Row 7: space for notes and month label¶
nrRows = 7¶
nrCols = 7¶
'For Word 2000 and later¶
Set tbl = doc.Tables.Add(Range:=doc.Range, _¶
NumRows:=nrRows, NumColumns:=nrCols, _¶
DefaultTableBehavior:=wdWord8TableBehavior)¶
'For Word 97¶
'Set tbl = doc.Tables.Add(Range:=doc.Range, NumRows:=nrRows, _¶
NumColumns:=nrCols)¶
Wrd
Search JabSto ::




Custom Search