WD6X: Word 6.0 for Windows TableMath Macro |
Q110091
The information in this article applies to:
-
Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
-
Microsoft Word for Windows, version 7.0
-
Microsoft Windows 3.1
SUMMARY
This article contains information about the TableMath macro, included with
Word 6.0 for Windows TABLES.DOT template (located in the <WINWORD>\MACROS
subdirectory, where <WINWORD> is the location of your Word for Windows
program directory). In Word 7.x for Windows, the TableMath macro is
included in the TABLE7.DOT, located in the \msoffice\winword\macro folder,
where msoffice and winword are the loction of your msoffice and Word for
windows folders.
NOTE: Most of the information provided below is also available in Help
(accessible by clicking the Show Help button) within the macro.
MORE INFORMATION
The Word 6.0 and 7.x for Windows the TableMath macro works equally well
outside of a table. If you're working in a table, you can highlight cells
prior to running the macro if a range is desired in the formula.
NOTE: The TableMath macro from the Application Note titled "WD0523:
WordBasic Macro Examples for Word for Windows 2.0" does not run correctly
in Word 6.0 or Word 7.x for Windows.
To start the TableMath macro
- From the Tools menu, choose Macro.
- Select the TableMath macro and choose Run.
If the macro isn't listed, you need to install it first.
To install the TableMath macro
Use one of the following methods to install TableMath.
Method 1
- From the File menu, choose Templates.
- Choose Add.
- In the Directories tree, select the <WINWORD>\MACROS subdirectory (where
<WINWORD> is the location of your Word for Windows directory).
- In Word 6.x, from the File Name list, select TABLES.DOT. In Word 7.x,
from the File Name list, select TABLE7.DOT.
- Choose OK for both dialog boxes.
Method 2
- From the Tools menu, choose Macro.
- Choose Organizer.
- Select the Macros tab.
- Attach one side of the dialog box to NORMAL.DOT and the other side to
TABLES.DOT (for Word 6.x) or TABLE7.DOT (for Word 7.x). Then copy the
TableMath macro to NORMAL.DOT.
LIST (drop-down list box)
Cells, Bookmarks, and Numbers are available if the insertion point is in a
table. If the insertion point is not in a table, Bookmarks and Numbers are
not available. (Bookmarks are available only if they exist within the
document.)
The "List" list may contain Cells, Bookmarks, or Numbers. To add an item to
the formula, either double-click the item or select it and click the
Include button.
Cells When you select Cells, the list displays the available cells
in the table. (These are indented within the list box to
allow accurate sorting within the macro.)
Note: Table cells that are added to the formula are removed
from the target list. This prevents formula errors when the
formula is pasted into the document.
Bookmarks When you select Bookmarks, the list shows all the bookmarks
in the document in alphabetical order.
Numbers Numbers are tested for accuracy (for example, four digits
between a period and a comma will not be accepted nor commas
to the right of a period). Negatives are allowed if at the
left of the number.
VALUES (list box)
As items are included in or excluded from this list, the formula is created
and updated. It is visible above the OK button.
To remove items from the Values list (and the formula), either double-
click the item (but not the last remaining item in the list) or select the
item and click the Exclude button. The formula updates automatically.
Note: Because table cells have been indented for sorting, they do not line
up with bookmarks or individual numbers. This indent is removed in the
formula.
SHOW VALUES (button)
If you select a table cell or bookmark in the List or Values group and
choose the Show Values button, a message box appears with the result of
that item.
This button is disabled if the selection is not a single table cell or
bookmark.
CALCULATION TYPE (drop-down list)
This list displays different formula types. If a desired calculation type
is not available, choose the Advanced Formula button and see the Paste Function list for a more comprehensive list.
Messages are displayed if you select a calculation type that does not
operate with the items in the Values list. For example, if a range is in
the Values list, then ABS, Division, Exponent, Int, and Subtraction do not
work.
When you select a range in the table as the macro is run, the SUM
calculation type will automatically be selected, and the range will be
added to the formula.
TARGET CELL/CLIPBOARD (list box and check box)
The Target Cell list remains disabled until you clear the Clipboard check
box.
In table:
- Clipboard check box is selected: A message box will appear informing you
to move the insertion point to where the formula will be placed and to
paste the formula there. If table cells are included in the formula, the
message will recommend that the formula be placed within the table to
avoid errors.
- Clipboard check box is cleared: When the Clipboard check box is cleared,
the Target Cells list will be available, and you can select a location
for the formula to be placed. Remember: This list will not include any
table cells being used in the formula.
NOTE: The macro also checks whether the target cell has text currently
in it. If so, you are given the choice of replacing the current cell
contents with the formula or placing the formula at the end of the text
in the target cell.
Not in table:
- Clipboard check box is selected: A message box appears informing you to
move the insertion point to where the formula will be placed and to
paste the formula there.
- Clipboard check box is cleared: The Target Cell list remains disabled,
and the formula is placed in the document at the insertion point.
NUMBER FORMAT (drop-down list)
This list has formats for the formula results. If a desired format is not
listed, select Other Format at the bottom of the list. An input box appears
requesting a new format. After a format is entered and accepted, it appears
in the Number Format list. (NOTE: The macro does not test if the Other
Format is not a valid format. The final result may show an error if it is
invalid.)
ADVANCED FORMULA (button)
When you choose the Advanced Formula button, the macro defaults to Word's
internal Formula dialog box. This enables more advanced users to enter
their own formulas. The Target Cell and Clipboard options are still
available.
To return to the TableMath main dialog, choose the Regular Formula button.
Any original selections remain unchanged.
SHOW/CLOSE HELP (button)
Context-sensitive Help: Click an item in the main dialog then click the
Show Help button; help is displayed on that specific option.
Help is available in the main dialog. The bar at the bottom of the dialog
box changes depending upon the item selected.
The online Help (after clicking the Show Help button) gives an overview,
descriptions of the different main dialog components, and formula types.
The option buttons in the help screen allow you to quickly move to a
specific topic. To scroll through the help topics in order, click the Page
Up or Page Down button.
Additional query words:
TableMath macro hangs stops WordBasic