Wednesday, October 04, 2006

Calendar Tricks

Under.zip (XCalendar) "Calendar" - Generates a calendar in a manner far superior to Microsoft's method.

You like using the Calendar macro. You decide to print off a fresh calendar every month.

Here's what you can do to ease your workload even further:

Save a fresh calendar with a name like "Calendar", so you'll be able to find it again.

Open up the Visual Basic Editor (Tools, Macros, Visual Basic Editor).

In the VBE set a reference to UnderTheHood by choosing Tools, References.

In the module This Document, write or generate a short macro that will call the calendar macro each time the document is opened.

Private Sub Document_Open()
Dim dt As Date
dt = DateSerial(Year(Now()), Month(Now()), 1)
Call Under.XCalen.GenerateCalendarTable(dt, Selection.Tables(1))
End Sub


You can paste that code directly into the module, if you wish.

(Choose debug, Compile to check that you have no syntax errors)

Save and Close the Calendar document.

The next time you open Calendar.DOC, the calendar will be refreshed with the calendar for the current month.

If you are in the habit of printing off next month's calendar sometime in the last seven (7) days of the current month, you can fudge the date calculation like this:

dt = DateSerial(Year(Now() + 7), Month(Now() + 7), 1)