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-2017 by Barry MacDonnell. All Rights Reserved.

Page updated May 21, 2016

Three calendar macros that can -

•  Create full-page monthly calendars (in portrait or landscape) with two small (previous/next) monthly calendars at the top; or
•  Create yearly calendars, 12 months to a page, in several layouts; or
•  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 information on this site:

  • 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.

  • Need a smaller calendar for a single purpose (announcement, newsletter, web page, etc.)? You can create a small table to do the job. See Footnote 3.

From other macro authors:

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

  • Julian.wcm - a macro by Charles Rossiter that calculates Julian dates, and the numbers of days between 2 dates -- part of a suite of macros here.

See Disclaimer here

Monthly calendar.wcm 

(v1.05 - For WordPerfect 10 and later versions only) (Download)

Purpose

Monthly calendar.wcm creates a monthly calendar on one (Letter- or A4-size) page with two smaller (previous/next month) calendars at the top of the page.

You can create as many as 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, format the text, etc. 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).

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 (emphasize) a date cell:

Text: Any contents in the calendar's table cells are not formatted by default. You can simply select any text (including the date numbers) and apply formatting such as bold, a text color, colored highlighting, etc.

Border: Left-click on any cell in a calendar to position 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 the border and fill 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.

☼  Printing two calendars per page is easy with FinePrint (which can be used with any Windows program to save paper and ink/toner, preview printouts, print in various layouts including booklets, etc.). You can generate multiple monthly calendars in Landscape orientation, then simply print them "2-Up" in standard portrait mode with FinePrint from within WordPerfect. [Screen shot] (FinePrint is a well known commercial product. Not affiliated with the Toolbox for WordPerfect. Trial version available.)

Download CALENDARS.ZIP

Annual calendars.wcm 

(v1.04 - For WordPerfect 9 and later versions) (Download)

Purpose

Annual calendars.wcm creates 12 monthly calendars on one portrait-oriented page (Letter size, A4, etc.), in three different layouts --

Full Page, or
Two Columns (left and right sides of page), or
Two Rows (top and bottom of page).

[Screen shot of full page annual calendar (basic formatting)]

[Screen shot of two column annual calendar (partial picture)]

[Screen shot of two row annual calendar (partial picture)]

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.

•  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.

•  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) (Download)

Purpose

Find day of week.wcm - "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.)

Tips

☼  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 these small macroc: DATEINS (in the Library) or INSDATE.ZIP (direct download).

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) 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.

N.B.: The entire BoxImageRetrieve() command should be all on one line.

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 ()
// Next command adjusts default brightness value;

// delete if not needed:

BoxImageBrightness (Amount: 0.8)
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."

Footnote 3

Need a smaller calendar for a single purpose (e.g., to insert in an announcement, newsletter, web page, etc.)?

You can create a small table to do th job. [From my post on OfficeCommunity.com, 8/29/2013, where a user needed a monthly calendar for just the current month with the dimensions of 3.5" wide by 4.875" tall:]

"Calendars produced in WordPerfect are created with tables, so the custom calendar would have to be set up to match your custom size.

This can be done with a macro but I doubt such a custom size exists -- unless someone has created one and jumps in here to post it.

Meanwhile, as a workaround, you could manually create a template for such a calendar -- an empty version without dates -- with a table having the custom size dimensions containing a title row (e.g., September), a weekday row (S, M, T, ... ), and 5 empty rows for the days. 

That is, a 7 x 7 table, which should only take a few minutes (initially) to set up. After that the formatted table will be instantly available.

(The entire process below worked perfectly in my tests.)

Since your custom calendar table is 3.5" wide, each column would be 0.500" wide. I used this dimension for the 7 columns, and set the column width to "Always keep width the same" and the column margins to a small amount: 0.050".

Each row would be 0.696" high (4.875" divided by 7). I also set the row margins to 0.100" and chose "Single line only."

The title row's cells (row 1) can be joined into one cell be selecting them and using Table, Join, Cell.

Once you have added the weekday row labels (S,M,T,W,T,F,S -- justified center, and perhaps in a 12-point font), and justified the remaining rows that will contain the numbers, you can create a custom template and save it to disk. See [here]. 

When you load a new document based on that template, you can insert the dates very quickly with a small macro such as the following one. (You will need to enter the last day of the calendar month on the vTotalDays command. Or, you could just set it at 31 and later delete the extra days in the final calendar when needed.)

Just put the cursor in the cell where the first date should be, then play the macro. It will add the date numbers in 8-point font.

// Macro begins

// Cursor should be in the first table cell where the
// calendar begins (i.e., where a "1" should be inserted).

// Enter the date of the last day of the month (no quote marks):
vTotalDays:=30

FontSize(8p)
vDay:=1
Type(vDay)
Repeat
    PosCellNext
    vDay:=vDay+1
    Type(vDay)
Until(vDay=vTotalDays)
Quit

// Macro ends

To copy this code into your WordPerfect program to create a working macro, see [here].

You can edit the custom template to adjust the various row heights to produce a more pleasing layout, then save it back to disk."