Пример #1
0
        /// <summary>
        ///
        /// </summary>
        private void Test()
        {
            try
            {
                using (Excel.Application application = new Excel.ApplicationClass())
                {
                    application.DisplayAlerts     = false;
                    application.NewWorkbookEvent += Application1_NewWorkbookEvent;
                    using (Excel.Application application2 = application.DeepCopy())
                    {
                        application2.NewWorkbookEvent += Application2_NewWorkbookEvent;
                        application.Workbooks.Add();
                    }

                    application.Quit();
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.ToString());
            }
        }