Supported Mathematical Operators in WordBasic

Last reviewed: July 30, 1997
Article 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

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


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.