Home | Tips | Library | Other Authors | Other WP Sites | Writer's Links | Contact | Site Map | Donate

Barry MacDonnell's
Toolbox for WordPerfect
 

Macros, tips, and templates for Corel® WordPerfect® for Windows®
© Copyright 1996-2013 by Barry MacDonnell. All Rights Reserved.

Page updated Apr 28, 2012
Calendar macros -
(1) Create full page monthly calendars (in portrait or landscape) with two small (previous/next) monthly calendars at the top.
(2) Create yearly calendars, 12 to a page, in several layouts.
(3) Quickly find the day of the week a date falls on (e.g., October 26, 2004 was a Tuesday).

Download CALENDARS.ZIP (v1.05; 11/04/08; 87,195 bytes)

The individual macros are compatible with the WP versions noted in the next column. (Not for WP 11.0.0.233; see here for more.)

Downloading, Documentation, Modifications, and Support

Here is probably more than you ever wanted to know about calendars and related oddities:


(Somewhat) related links:

  • If you need to quickly calculate and/or insert a date that is "x" days in the future (or the past) from today, you can use this small macro: INSDATE.ZIP. (v1.02; 09/28/08; 6,660 bytes).
  • To calculate new dates using table cells, see here.


From other macro authors:

  • Daily calendar maker (a personal "Day-Timer" calendar) by Gordon McComb (see Sked.wcm here)

See Disclaimer here

Contains three macros:

Monthly calendar.wcm (v1.05 - For WordPerfect 10 and later versions only)

Creates a monthly calendar on one (Letter- or A4-size) page with two smaller (previous/next month) calendars at the top of the page. Many formatting options are available from a pop up menu. You can also create up to 120 sequential monthly calendars in one operation.

[Screen shot of resulting monthly calendar document]

  • The calendars are created in WordPerfect tables so you can type inside any table cell. You can also select cells and join them, if desired.
  • Several options are available from a dialog menu. [Screen shot of monthly macro calendar menu] You can choose the month, year, number of sequential calendars, page size (letter, A4), orientation (portrait, landscape), page margins, page background (white, color, transparent), subtitle text, and footer text and/or date. Several more formatting options are available in the User Modification Area of the macro's code (you can view them by opening the macro for editing; here's how to download and modify macros from this site).

New in v1.05: An option on the menu lets you specify whether the weeks should start on Sunday or Monday. You can now set the defaults for the text labels used for the month (e.g., November) and week days in the User Modification Area at the top of the macro's code (see last Tip below); this lets you use another language's text labels (e.g., Novembre) instead of English labels (e.g., November) on the calendars. Note that this will change only the text labels on the printed calendars (and in the "Choose the Month" drop list on the menu).

TIPS

  • Mark a date cell: 
    • Border: Left-click on any date in a calendar to put the cursor in the cell (or click-and-drag to select several cells), then right-click to bring up the context menu. Choose Borders/Fill, then (in the Cell tab) choose Outside. Choose a heavy border, then choose a Color. Click OK to return to the document. The date cell will have a thick border around it.
    • Fill: Similar to applying a border, but use the "Cell Fill" column and choose a fill percent (e.g., 10%), and optionally a color (e.g., Yellow). For a simple macro to do this for one or more cells, see this post on WordPerfect Universe. (Several such macros, assigned to a toolbar, could help you use various colors for different events.)
    • Remove these changes by clicking the Border/Fill dialog icons and choosing "X" (none).
  • Insert your favorite watermark image on the page(s). Select the Transparent option from the menu to allow the watermark to show through the calendar, then create the calendar(s). Position the cursor at the very top of the document, and click Insert, Watermark, Create. Insert your favorite image. Stretch the image to fill the watermark window. Adjust watermark shading from the watermark property bar, if desired. Click File, Close to return to the main document. [See also Footnote 1 below.]
  • An option on the menu lets you split weekday (date) rows horizontally. See the User Modification Area at the top of the macro's code for various related options you can set as defaults: For example, you can shade the weekday rows (i.e., cells with day numbers); remove bottom cell border lines from the weekday number rows; or use a dashed or dotted line as dividing lines. Now you can more easily select and join cells across weekdays so that you can span several days with a space to write common information (e.g., "On vacation" or "Trip to London").
  • You have the option to remove cell borders from all non-date cells (those cells before the first day and after the last day of each month); this might be useful on printed calendars to provide extra white space for writing notes or reminders on the calendar. [Note that cell borders are visible only if you disable (un-tick) WordPerfect's View, Table Gridlines. The cell border's guidelines are visible if you enable (tick) WordPerfect's View, Guidelines, Tables. For more on these features, see here.]
  • You can place your cursor inside a table cell in the main calendar and insert clip art with Insert, Graphics, Clipart. The clip art image will be automatically sized to fit the table cell; right-click the image and choose Image Tools to adjust the Brightness to allow text to show through the graphic image.
  • The two small calendars on each monthly calendar page are created with tables placed inside graphic boxes, which act as "containers" to hold the calendars. You can copy a box (use Reveal Codes to locate, select, and copy the [Box] code) and paste that box into another document where you might want to use a small (approximately 1.4" wide) calendar. The box can be dragged into position. Right-click the box for various options (which includes the choice, "Delete Box," in case you don't want these mini-calendars).
  • See the redlined User Modification Area at the top of the macro's code to make changes to the menu or other default values. You can open a macro just like any other WordPerfect document, then save your edits with the Save&Compile button on the macro property bar.

Download CALENDARS.ZIP

Annual calendars.wcm (v1.04) - (For WordPerfect 9 and later versions)

Creates 12 monthly calendars on one portrait-oriented page (Letter size, A4, etc.), in three different layouts -- Full Page. Two Columns (left and right sides of page), and Two Rows (top and bottom of page).

New in v1.04: An option on the menu lets you specify whether the weeks should start on Sunday or Monday. You can now set the defaults for the text labels used for the month (e.g., November) and week days in the User Modification Area at the top of the macro's code (see last Tip below); this lets you use another language's text labels (e.g., Novembre) instead of English labels (e.g., November) on the calendars. Note that this will change only the text labels on the printed calendars.

NOTES and TIPS

  • For the two column/row formats, you can type text between the calendars. This makes these formats useful for announcements, meeting agendas, events, reminder lists, etc.
    [Screen shot of two column annual calendar (partial picture)]
    [Screen shot of two row annual calendar (partial picture)]
  • You can choose to create the calendars in color or make them transparent so that a watermark will show through the calendars. [UPDATE: See Footnote 1 below.]
  • You can also add a header and/or footer to the page.
    [Screen shot of annual calendar macro menu]
  • Calendars are created in 12 small tables of fixed sizes. Depending on your printer driver, you may need to adjust margins to make the 12 calendars fit on one page.
  • A menu option lets you split weekday rows horizontally (N.B.: Full Page format only): Once split, select contiguous cells, right-click them, then choose Join Cells. You can then type information that spans multiple days. You can also apply a color "fill" to the joined cells by selecting the cells and right-clicking them, then choosing Borders/Fill, then Cell Fill to set the intensity.
  • Once all calendars are created, you can edit the page and select a single calendar (or a six-month boxed calendar) to copy it to another document. Be sure to use Reveal Codes and select everything from the [Tbl Def] code to the [Tbl Off] code for the particular calendar you want to copy. Pasting a single calendar into a text box (that you can resize to "hug" the calendar) will let you drag the calendar to a new location; the text box can have body text wrapped around it by selecting the box, right-clicking it, and choosing Wrap.
  • See the redlined User Modification Area at the top of the macro's code to make changes to the menu or other default values. You can set the menu and calendar text defaults by opening the macro like any other document and following the instructions at the top of the code. Then Save&Compile the macro from the property bar. For example, you can add your company name so that it appears automatically in the header text.

Download CALENDARS.ZIP

Find day of week.wcm (v1.02) - (For WordPerfect 8 and later versions; may also work in earlier versions)

"Perpetual calendar" - Select a month, day, and year form a menu and the macro will tell you what day of the week the date falls on. Useful for any date since about the time the Gregorian calendar was introduced in A.D. 1582. (The macro input field is limited to dates from A.D. 1600-2400, but the macro was not tested with far future dates.)

TIP

  • If you need to quickly calculate and/or insert a date that is "x" days in the future (or the past) from today, you can use this small macro: INSDATE.ZIP. (v1.02; 09/28/08; 6,660 bytes).
    Screen shots: [Main dialog menu][Calulated results]

TIP (for advanced users)

  • The "engine" (code routine) that does the work of finding the day of the week in this macro was also used in the Annual calendars macro above. It may be of interest to programmers who want to create their own monthly or yearly calendars with a macro. It was based on a mathematical formula called Zeller's Rule (see, for example, http://mathforum.org/dr.math/faq/faq.calendar.html or, more briefly, Footnote 2) .

Download CALENDARS.ZIP

Page Top



Footnote 1

Intermediate to Advanced users:

Until I get around to modifying the macro's code with new features to incorporate ideas such as the following, you could create one or more macros that insert a graphic image as a full-page watermark, similar to the one shown in the example page linked above. They could be chosen from a small menu, similar to the way other items can be attached to menus (described here). You would simply create a calendar and play the appropriate image-inserting macro.

In the following example code (created by recording a macro in WP11.0.0.300) you will need to change the path and name of the graphic image in the BoxImageRetrieve() command to the path and name of the image on your own system. Also, if you use the A4 paper size, change the dimensions in the BoxWidth() command to 8.3" and the box height() command to 1.7".

WatermarkA (Action: Create!; Margin: Off!)
BoxCreate (BoxType: WatermarkImageBox!)
BoxContentType (Content: Image!)
BoxImageRetrieve (Action: MakeInternal!; Filename:
"
D:\Corel\WordPerfect Office 11\Graphics\Clipart\Landscap\g0800946.wpg")
BoxUpdateDisplay ()
BoxImageBrightness (Amount: 0.8) //
(<= adjusts default value; delete if not needed)
BoxUpdateDisplay ()
BoxHorizontalAlignment (Alignment: AlignMargins!; Position: Left!)
BoxWidth (Width:
8.5")
BoxVerticalAlignment (Alignment: Top!)
BoxHeight (Height:
11.0")
BoxUpdateDisplay ()
Close ()

Footnote 2

Zeller's Rule (from "The Calendar and the Days of the Week" - http://mathforum.org/dr.math/faq/faq.calendar.html)

"[It] ... will only work for the Gregorian calendar. (People in English-speaking countries used a different calendar before September 14, 1752.)"

The following formula is named Zeller's Rule after a Reverend Zeller. [x] means the greatest integer that is smaller than or equal to x. You can find this number by just dropping everything after the decimal point. For example, [3.79] is 3. Here's the formula:

f = k + [(13*m-1)/5] + D + [D/4] + [C/4] - 2*C.

  • k is the day of the month. Let's use January 29, 2064 as an example. For this date, k = 29.
  • m is the month number. Months have to be counted specially for Zeller's Rule: March is 1, April is 2, and so on to February, which is 12. (This makes the formula simpler, because on leap years February 29 is counted as the last day of the year.) Because of this rule, January and February are always counted as the 11th and 12th months of the previous year. In our example, m = 11.
  • D is the last two digits of the year. Because in our example we are using January (see previous bullet) D = 63 even though we are using a date from 2064.
  • C stands for century: it's the first two digits of the year. In our case, C = 20.

Now let's substitute our example numbers into the formula.

f = k + [(13*m-1)/5] + D + [D/4] + [C/4] - 2*C
= 29 + [(13*11-1)/5] + 63 + [63/4] + [20/4] - 2*20
= 29 + [28.4] + 63 + [15.75] + [5] - 40
= 29 + 28 + 63 + 15 + 5 - 40
= 100.

Once we have found f, we divide it by 7 and take the remainder. Note that if the result for f is negative, care must be taken in calculating the proper remainder. Suppose f = -17. When we divide by 7, we have to follow the same rules as for the greatest integer function; namely we find the greatest multiple of 7 less than -17, so the remainder will be positive (or zero). -21 is the greatest multiple of 7 less than -17, so the remainder is 4 since -21 + 4 = -17. Alternatively, we can say that -7 goes into -17 twice, making -14 and leaving a remainder of -3, then add 7 since the remainder is negative, so -3 + 7 is again a remainder of 4.

A remainder of 0 corresponds to Sunday, 1 means Monday, etc. For our example, 100 / 7 = 14, remainder 2, so January 29, 2064 will be a Tuesday."