How to use Visual C# to automate a running instance of an Office program
http://support2.microsoft.com/default.aspx?scid=kb;EN-US;316126
Excel.Application oExcelApp;
Excel.Workbook xlwkbook = (Excel.Workbook)System.Runtime.InteropServices.Marshal.BindToMoniker(@"C:\temp\booke1.xlsx");
Excel.Worksheet s = xlwkbook.ActiveSheet;
Range x = s.Cells[2, 1];
x.Value = "bbcccccbbbb";
MessageBox.Show(xlwkbook.Path);
//xlwkbook.Save();
//Release the reference.
oExcelApp = null;
Excel.Application oExcelApp;
Excel.Workbook xlwkbook = (Excel.Workbook)System.Runtime.InteropServices.Marshal.BindToMoniker(@"C:\temp\booke1.xlsx");
Excel.Worksheet s = xlwkbook.ActiveSheet;
Range x = s.Cells[2, 1];
x.Value = "bbcccccbbbb";
MessageBox.Show(xlwkbook.Path);
//xlwkbook.Save();
//Release the reference.
oExcelApp = null;
댓글
댓글 쓰기