jack burton

jack burton

  • NA
  • 3
  • 12.7k

Open Excel 2007 from C#

Aug 4 2008 6:15 AM

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)