>..snip..
>
>Hi Dragan,
>
>I tried putting code in the onexit of a group "_pageno = 0"..but that didn't seem to work. Maybe I can't put the code directly and must call a function?
It only evaluates an expression there, that's why it has to be a function, even if it has no use for the result at all. In your case, it probably evaluated to .f. (_pageno is zero before you start printing). Just make it an one-line function in a separate .prg file, make sure it's on the path, and put the call to it in the On Exit textbox.