我只需要在当前打开的 Microsoft Excel 实例中获取当前打开文档的列表。
但是我不懂Excel术语,不知道这些文档是叫工作簿,还是工作表,还是窗口等等。
任何想法
最佳答案
找到了 (link) .
//Excel Application Object
Microsoft.Office.Interop.Excel.Application oExcelApp;
this.Activate ( );
//Get reference to Excel.Application from the ROT.
oExcelApp = ( Microsoft.Office.Interop.Excel.Application ) System.Runtime.InteropServices.Marshal.GetActiveObject ( "Excel.Application" );
//Display the name of the object.
MessageBox.Show ( oExcelApp.ActiveWorkbook.FullName );
//Release the reference.
oExcelApp = null;
关于c# - 如何使用C#获取Excel中当前打开的文档?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2449387/