Microsoft KB Archive/74050

{|
 * width="100%"|

Supported Mathematical Operators in WordBasic

 * }

Q74050

-

The information in this article applies to:


 * Microsoft Word for Windows, versions 1.0, 1.1, 1.1a, 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c, 6.0, 6.0a, 6.0c

-

SUMMARY
Exponential calculations do not have a supported mathematical operator in WordBasic. The following table indicates the mathematical operators that are supported using Microsoft WordBasic:

  Operator     Operation Performed ---

Changes precedence; performs the operation inside the parentheses first

-           Negative value

*           Multiply

/           Divide

Mod         Round both numbers to integers, divide, and return the remainder

+           Add

-           Subtract Examples:

  total = (23 - 1)/2

x = (6 * 3) + 2

MORE INFORMATION
To perform a mathematical calculation that involves exponents, you must use the UtilCalculate function. This functions returns a value to a numeric variable. For example, in version 1.x of Word for Windows, to find out what 2 to the eighth power (2^8) is, you need the following WordBasic statement:

"x = UtilCalculate(&quot;2^8&quot;)" In version 2.0 of Word for Windows, you need the following WordBasic statement:

"x=ToolsCalculate(&quot;2^8&quot;)" For more information on calculations with exponents, query on:

"Exponent and"