Exemple #1
0
        //grabs file handle of open excel instances
        public static void excelHandle()
        {
            var myApps = new ExcelAppCollection();

            string[] xlInst;
            IEnumerable <Process> procs = myApps.GetProcesses();

            foreach (Process p in procs)
            {
                int i = 0;
                try
                {
                }
                catch (Exception ex) { Console.WriteLine(ex); }
            }
        }
Exemple #2
0
        public static void excelHandle()
        {
            var myApps = new ExcelAppCollection();

            IEnumerable <Process> procs = myApps.GetProcesses();

            foreach (Process p in procs)
            {
                try
                {
                    Application a        = myApps.FromProcess(p);
                    string      fullPath = a.ActiveWorkbook.FullName;
                    Console.WriteLine(a);
                }
                catch (Exception ex) { Console.WriteLine(ex); }
            }
            Console.ReadLine();
        }