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

Page updated Dec 12, 2019

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.06; 12/12/19; 92,214 bytes)

The 3 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


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.

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

Disclaimer
Monthly calendar.wcm (UPDATED to v1.06)
(For WordPerfect 10 [released in 2001] and later versions)

(Download CALENDARS.ZIP)
Purpose and operation

Monthly calendar.wcm ccreates a full-page monthly calendar (or several sequential monthly calendars) in a single printable document.

Unlike some other methods, the macro produces two small calendars at the top of each page -- one for the previous month and one for the following month.

[Screen shot of a resulting monthly calendar]

From a pop-up menu you can create your chosen monthly calendar -- or even multiple calendars for any desired number of sequential months (2-120). Sequential calendars are also created in a single document, one month per page, so that you can edit them and/or save them to disk.

All calendars are formatted using tables so you can type inside any table cell, join or split cells, enhance cell borders, add background fills, etc., when the calendar(s) are on screen.

Several options are available on a menu that appears when you play the macro:

•    Create the calendars in either Letter or A4 sizes
•    Set the beginning day of week (Sunday or Monday)
•    Print multiple sequential calendars (up to 120 months)
•    Set page margins
•    Set calendar background to white, color, or transparent (the default)
•    Split date cells (date rows) horizontally, and shade them if desired
•    Insert a title, subtitle, and/or print date
•    [New in v1.06] Use either a "contemporary" table style (borders removed from around all date cells) or the program's default "grid" table style

Most users probably will just click OK or press Enter to produce a simple calendar for the current month.

Modifications

You can easily enable or change additional options (e.g., font type; custom month names and labels for days of the week; etc.) and/or change various menu default settings in the redlined User Modification Area at the top of the main macro code.

Note that some options are not on the macro's menu, so they must be set inside the macro itself.

For example, you can 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 those text labels on the printed calendars (and in the "Choose the Month" drop list on the menu), but not any of the macro menu's other text.]

You can open a macro file (.wcm) just like any other WordPerfect document (.wpd), then save your edits with the Save & Compile button on the macro toolbar that should appear under the program's main toolbar. (If that bar is not visible, use Tools, Macro, Macro Toolbar to display it.)

For more help on downloading or modifying macros from this site see here.

Notes

¤  Table cell borders are visible only if you disable (un-tick) View, Table Gridlines on the WordPerfect menu. However, the cell border's guidelines (which are different things) are visible if you enable (tick) WordPerfect's View, Guidelines, Tables. For more on these interactive WordPerfect features, see here.

¤  To those who have used earlier versions of this macro (v1.05 and earlier):
Due to the number of custom adjustments needed to reliably create landscape calendars that fit properly on typical page sizes (e.g., page margin constraints on the calendar, A4-size changes to the printable area, various table dimensions, etc.), the option to create calendars in landscape orientation was removed in version 1.06. (Sorry, but I can no longer devote the time and effort to deal with such complex, interactive issues that do not substantially detract from the main purpose of the macro.)

Tips


☼  Mark (emphasize) date cells:

Text: Any contents in the calendar's table cells are not formatted by default. You can simply select any text (including 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 (optionally) choose a Color. Click OK to return to the document. The date cell will now have a thick border around it/them.

Fill: Similar to applying a border, but instead use the "Cell Fill" column and choose a fill percent (e.g., 10%), and optionally a color foreground (e.g., Yellow). For a simple macro that you can record to do this for one or more cells (and a sample of the macro code), see Footnote 4 below. Several such macros, each set to apply a different color and assigned to a toolbar or menu, could help you use various table cell fills for different events.

☼  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(s), When created, 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 here for more on using watermarks. [See also Footnote 1 below.]

☼  An option on the menu lets you split weekday (date) rows horizontally. This helps organize any typed-in text. [Screen shot showing split rows]

This option is turned on by default.

See the redlined 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 joined cells or 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 horizontal dividing lines.

With split rows you can more easily select and join the user text areas of cells (right-click on the selection and choose Join Cells) across weekdays so that you can span several days with a single space to write or type relevant information (e.g., "On vacation" or "Trip to London").

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

☼  Printing two calendars per page.

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

Annual calendars.wcm (v1.04)
(For WordPerfect 9 [released in 1999] and later versions)

(Download CALENDARS.ZIP)
Purpose

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

•   Full Page 

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


•   Two Columns (left and right sides of page)
    [Screen shot of two-column annual calendar (partial picture)]

•   Two Rows (top and bottom of page)
    [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.

Also, 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.


Find day of week.wcm (v1.02)
(For WordPerfect 8 [released in 1997] and later versions)

(Download CALENDARS.ZIP)
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).

Page Top



Footnote 1
[...Continued from above:]

Intermediate to Advanced users:

You could create one or more macros that insert a graphic image as a full-page watermark. 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
[...Continued from above:]

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
[...Continued from above:]

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

Footnote 4
[...Continued from above:]

•  You can use a macro to instantly fill one or more cells with a background color.

Here's how to record such a macro:

1. Create a new table first (Table, Create). Then place the cursor in any one of the table cells. (Important: Just use your mouse to single-click inside a cell to place the cursor there -- don't select the cell so that the cell turns black.)

2. Start recording:

Click Tools, Macro, Record. Give it a name and click Record.

3. Click on Table, Borders/Fill.

Under the "Cell fill" column, click the Fill icon and choose a fill percent (e.g., 10% Fill).

Optionally, choose a Foreground color (e.g., Yellow). Leave the background white (i.e., Red=255, Green=255, Blue=255).

Note: The use of "Foreground" here is correct (though slightly confusing). You are setting up a fill color's foreground layer, and when the fill is applied to the table cell it will be applied to that cell's background layer (i.e., underneath the cell's text).

Re-adjust the fill/color to suit your needs. Click OK.

4. Stop recording:

Either click the solid square button on the macro toolbar (■) or click Tools, Macro, Record again to turn off the recorder.


The current table cell should now have the fill applied.

5. Test the macro:

Click in any other cell and play the macro (Tools, Macro, Play). Also, you can left-click-drag to select several adjacent cells, then play the macro.

- - - - -
Notes on creating and adjusting your own table cell "color filling" macro(s):

▸ If you select several table cells before playing the recorded macro so as to fill all of them with color, the cells probably will remain selected when the macro ends. As in the example code below you can edit the recorded macro (Tools, Macro, Edit) and add the command SelectOff at the end of the macro code. (No harm is done using this command if no cells were selected, it just helps "clean up" the results.)


The If..Endif segment at the top of the code was manually added to the recorded macro to account for the possibility of not playing the macro inside a table, and to display a small message to the user if that should happen.

▸ After testing the macro the TableCellFillColors command was edited to change the Foreground Color Shade to 30% to improve appearance when using a monochrome printer. Adjust to suit your preference (e.g., 25 = 25% shade).

Finally, extra spacing was added between the TableCellFill... commands for clarity. Sometimes you will get a few duplicate commands or duplicate segments when recording a macro. The bottommost of the duplicates will take precedence over previous commands of the same type -- but you might want to simply delete the duplicates to minimize confusion, especially when you edit these commands.

•  Here is an example of a recorded macro (edited to add an If..Endif error message segment) that adds a pale yellow fill (i.e., Foreground RGB=255,255,0 and Shade=30 (percent)) to the current cell or to a selection of cells.

Tip: To copy this example macro code into your WordPerfect program to create a working macro, see here. Then you can assign the macro to a menu item, a toolbar button or a keystroke for quick and easy access: see here.

// Macro code begins

If(Not ?InTable)
    Messagebox (;"Add a table cell [fill] color";
    "Ooops ... cursor is not in a table!"
    +NToC(0F90Ah)+ "Place the cursor in a table cell (or select"
    +NToC(0F90Ah)+ "
several adjacent cells) before playing this macro.";
    IconWarning!)
    Quit
Endif

TableCellFillStyle (FillPattern: Fill10!)

TableCellFillColors (ForeColorRed: 255; ForeColorGreen: 255; ForeColorBlue: 0; ForeColorShade: 30; BackColorRed: 255; BackColorGreen: 255; BackColorBlue: 255; BackColorShade: 100)

SelectOff
Quit

// Macro code ends

Tip: Create different versions of this macro (and named differently) to use different colors in the same table. A custom toolbar for the purpose might help.

•  Here is an example of a macro to remove the current fill (or any color) from the current cell or a selection of cells.

Tip: To copy this example macro code into your WordPerfect program to create a working macro, see here. Then you can assign the macro to a menu item, a toolbar button or a keystroke for quick and easy access: see here.

// Macro code begins

If (Not ?InTable)
    Messagebox (;"Remove table cell [fill] color";
    "Ooops ... cursor is not inside a table!"
    +NToC(0F90Ah)+ "Place the cursor in a table cell (or select"
    +NToC(0F90Ah)+ "several adjacent cells) before playing this macro.";
    IconWarning!)

    Quit
Endif

TableCellFillStyle (FillPattern: NoFill!)

SelectOff
Quit

// Macro code ends