1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| using System;
using Excel;
using Microsoft.Vbe.Interop.Forms;
----------------------------------------------
Excel.Application app = new Excel.Application();
Excel.Workbook workBook = app.Workbooks.Open("C:\test.xls", 0, true, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 0, 0);
Excel.Sheets wsFeuillesALire = workBook.Worksheets;
foreach (Excel.Worksheet workSheet in wsFeuillesALire)
{
if (workSheet.Name.Equals("Offre"))
{
Excel.OLEObjects oleObjects1 = (Excel.OLEObjects)workSheet.OLEObjects(Type.Missing);
foreach (Excel.OLEObject ole in oleObjects1)
{
Microsoft.Vbe.Interop.Forms.ComboBox newBox = (Microsoft.Vbe.Interop.Forms.ComboBox)(((Excel.OLEObject)ole).Object);
Console.WriteLine(newBox.SelText.ToString());
}
}
} |
Partager