How to get current open documents in Excel using C #?

All I need to do is get a list of open documents in the current open instance of Microsoft Excel.

But I don’t know the terminology of Excel to find out if these documents are called books, sheets or windows, etc.

Any ideas

+4
source share
2 answers

Found (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; 
+3
source

You are looking for the property Workbooks.

+1
source

Source: https://habr.com/ru/post/1304183/


All Articles