2
Answers

Open Excel 2007 from C#

jack burton

jack burton

16y
12.7k
1

Hi there,

 

How can I open an excel file from c# so that the application actually opens on screen?

The below code opens the file but it doesnt open onscreen - what am i missing?

 

Thanks

 

JB

<CODE>

string filePath = (Environment.CurrentDirectory + @"\xlsx\Book2.xlsm");

Microsoft.Office.Interop.Excel.ApplicationClass excelApp = new Microsoft.Office.Interop.Excel.ApplicationClass();

// Microsoft.Office.Interop.Excel.Workbook workBook = excelApp.Workbooks.Open(filePath, 0,

// true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows,

// "\t", false, false, 0, true, 1, 0);

Workbook workBook = excelApp.Workbooks.Open(filePath,

Type.Missing, Type.Missing, Type.Missing, Type.Missing,

Type.Missing, Type.Missing, Type.Missing, Type.Missing,

Type.Missing, Type.Missing, Type.Missing, Type.Missing,

Type.Missing, Type.Missing);</CODE>

Answers (2)
Next Recommended Forum