PROCEDURE ApplicationEvents2_DocumentBeforeClose( toDoc AS VARIANT, tlCancel AS LOGICAL) AS VOID IF NOT This.lOk2CloseWord tlCancel = .T. ENDIF ENDPROCYou have to set the lOK2CloseWord flag to .T. right before you call its Quit() method. You can get rid of all the other flags in my sample code in WordWrapper.prg.