Microsoft KB Archive/65132

Counting Variations in FOR NEXT Loops in Word for Windows

PSS ID Number: Q65132 Article last modified on 02-18-1993

1.00 1.10 WINDOWS

Summary: The following two macros should be functionally equivalent: Sub Main | Sub Main cInLoop = 0 | cInLoop = 0 cBegin = 0 | cBegin = 0 cEnd = 0.1 | cEnd = 0.1 cInc = 0.01 | cInc = 1.01 For x = cBegin to cEnd Step cInc |For x = cBegin to cEnd Step cInc -1 cInLoop = cInLoop + 1 | cInLoop = cInLoop + 1 Next | Next Print STR$(x) + STR$ (cInLoop) | Print STR$(x) + STR$ (cInLoop) End Sub | End Sub However, the macro on the left correctly loops 11 times, while the macro on the right loops only 10 times. Microsoft has confirmed this to be a problem in Word for Windows versions 1.00 and 1.10. We are researching this problem and will post new information here as it becomes available.

Reference(s): “Microsoft Word for Windows and OS/2 Technical Reference” pages 42-45

Additional reference words: w4wmacro 1.00 1.10