ActivateWorksheet
        (
            Worksheet worksheet
        )
        {
            Debug.Assert(worksheet != null);
            AssertValid();

            ExcelActiveWorksheetState oExcelActiveWorksheetState =
                GetActiveWorksheetState();

            ExcelUtil.ActivateWorksheet(worksheet);

            return(oExcelActiveWorksheetState);
        }
        Restore
        (
            ExcelActiveWorksheetState excelActiveWorksheetState
        )
        {
            Debug.Assert(excelActiveWorksheetState != null);
            AssertValid();

            Worksheet oWorksheetToActivate =
                excelActiveWorksheetState.ActiveWorksheet;

            if (oWorksheetToActivate != null)
            {
                ExcelUtil.ActivateWorksheet(oWorksheetToActivate);
            }

            m_oWorkbook.Application.ScreenUpdating =
                excelActiveWorksheetState.ScreenUpdating;
        }
        //*************************************************************************
        //  Method: Restore()
        //
        /// <summary>
        /// Activates the worksheet that was active before <see
        /// cref="ActivateWorksheet" /> or <see cref="GetActiveWorksheetState" />
        /// was called.
        /// </summary>
        ///
        /// <param name="excelActiveWorksheetState">
        /// The object that was returned by <see cref="ActivateWorksheet" />.
        /// </param>
        ///
        /// <remarks>
        /// Excel's screen updating is turned back on if it was on before <see
        /// cref="ActivateWorksheet" /> was called.
        /// </remarks>
        //*************************************************************************
        public void Restore(
            ExcelActiveWorksheetState excelActiveWorksheetState
            )
        {
            Debug.Assert(excelActiveWorksheetState != null);
            AssertValid();

            Worksheet oWorksheetToActivate =
            excelActiveWorksheetState.ActiveWorksheet;

            if (oWorksheetToActivate != null)
            {
            ExcelUtil.ActivateWorksheet(oWorksheetToActivate);
            }

            m_oWorkbook.Application.ScreenUpdating =
            excelActiveWorksheetState.ScreenUpdating;
        }