static void CloseDocProc( object stateInfo ) { try { // maybe we need some checks for the right // document, but this is a simple sample... SendKeys.SendWait( "^{F4}" ); } catch( Exception ex ) { Util.ErrorMsg( ex.Message ); } }