Microsoft KB Archive/86765

= WD: Sample Function to Determine If Value Is Odd/Even =

Article ID: 86765

Article Last Modified on 11/16/2006

-

APPLIES TO


 * Microsoft Word 1.0 Standard Edition
 * Microsoft Word 1.1 Standard Edition
 * Microsoft Word 1.1 Standard Edition
 * Microsoft Word 2.0 Standard Edition
 * Microsoft Word 2.0a
 * Microsoft Office Word 2003
 * Microsoft Word 2.0c
 * Microsoft Word 6.0 Standard Edition
 * Microsoft Word 6.0a
 * Microsoft Word 6.0c
 * Microsoft Word 95 Standard Edition
 * Microsoft Word 95a
 * Microsoft Word 97 Standard Edition
 * Microsoft Word 6.0 for Macintosh
 * Microsoft Word 6.01 for Macintosh

-



This article was previously published under Q86765



SUMMARY
The following Microsoft Visual Basic for Applications / WordBasic macro code checks to see if the number 11 is odd or even. You can substitute another number or a numeric variable for the number 11. If 11 Mod 2 = 0 Then Print &quot;Number is even&quot; Else Print &quot;Number is odd&quot; End If The MOD operator divides two numbers and returns only the remainder. For example, the result of the expression 19 MOD 7 is 5. The numbers can be any numeric expressions.

