Supported Mathematical Operators in WordBasic

ID: Q74050

The information in this article applies to:

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("2^8")

In version 2.0 of Word for Windows, you need the following WordBasic statement:

   x=ToolsCalculate("2^8")


For more information on calculations with exponents, query on:

   Exponent and

REFERENCES

"Microsoft Word for Windows and OS/2 Technical Reference," page 28

"Microsoft WordBASIC Primer," page 176

Kbcategory: kbusage kbmacro KBSubcategory: Additional query words: winword2 6.0 6.0a 6.0c 1.x 2.0 word6 winword 2.0a 2.0a-CD 2.0b 2.0c

Version           : 1.x 2.x 6.0
Platform          : WINDOWS

Last Reviewed: July 30, 1997