WD: ToolsCalculate w/ Combination Cell Range and Table BookmarkLast reviewed: February 2, 1998Article ID: Q113836 |
The information in this article applies to:
SYMPTOMThe ToolsCalculate WordBasic command gives a WordBasic error 24 "bad parameter" if the function form is used with both a cell reference and a table bookmark. The example on page 747 of the "Microsoft Word Developer's Kit" is not correct.
CAUSEThe ToolsCalculate function in Microsoft WordBasic takes the form
ToolsCalculate([Expression$])where Expression$ takes the form of the =(Formula) field. Expression$ can have arguments that are numbers, bookmarks, or table cells. Combinations can also be used as arguments. However, the following example (as shown on page 747), which specifies the use of specific cell references within two bookmarked tables, is not a valid expression and gives a WordBasic error 24 "bad parameter":
total = ToolsCalculate("sum(sales a5, other b5)")This construction behaves correctly for formula fields. The following field yields the correct result:
{= sum(sales a5, other b5)} RESOLUTIONYou can simulate the functionality of the WordBasic statement above by bookmarking cell a5 of the "Sales" table and cell b5 of the "Other" table and then adding the two bookmarks (see example 3 below).
ExamplesThe following are all valid uses of the WordBasic ToolsCalculate command. (Note: In the following examples, "Sales" is a bookmarked table, "Units" is a bookmarked cell whose value is 10, and "Cost" is a bookmarked number elsewhere in the document whose value is 2.5.)
|
Additional query words: err message Word Basic macro
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |