Supported Mathematical Operators in WordBasic

ID: 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("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

Additional query words: winword2 6.0 1.x 2.0 word6 winword

Keywords :
Version : WINDOWS:1.0,1.1,1.1a,2.0,2.0a,2.0a-CD,2.0b,2.0c,6.0,6.0a,6.0c
Platform : WINDOWS
Issue type :


Last Reviewed: December 23, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.