How to check whether excel file is already opened with C#
Excel.Application oExcelApp; using Excel = Microsoft.Office.Interop.Excel; .... .... Excel.Workbook xlwkbook = (Excel.Workbook)System.Runtime.InteropServices.Marshal.BindToMoniker(@"C:\temp\book1.xlsx"); //True : already opened by human. False : not opened by human bool isOpened = xlwkbook.Application.Windows["book1.xlsx"].Visible; Trace.WriteLine(isVis);
댓글
댓글 쓰기