Charlie,
TEXT ..ENDTEXT outputs lines of text to a device. _PAGENO is incremented based on the value of _PLENGTH (which by default is 66), thus every 66 lines the _PAGENO is incremented. Also, the output starts at _PLINENO which may not be 0 when your program starts executing.
Thus, nPages = INT((_PLINENO + nLines)/_PLENGTH) + 1, where nLines is the number of lines of text output, 129 in this case.
HTH
>TEXT ENDTEXT causes the _PAGENO variable to be incremented. Here's the repo code:
>
>CLEAR
>_PAGENO = 1
>HoldPage = _PAGENO
>
>FOR x = 1 TO 129
> TEXT TO m.myVar NOSHOW
> "Hello World"
> ENDTEXT
> IF _PAGENO <> m.HoldPage
> HoldPage = _PAGENO
> ? 'x = ' + TRANSFORM(m.x) + " and _PAGENO = " + TRANSFORM(_PAGENO)
> ENDIF
>ENDFOR
>? _PAGENO
>
>For me, running this in VFP 7 or 8 causes the _PAGENO variable to increment to 3. If I'm missing something, please let me know.