1

Am trying to export data from an array to an Excel worksheet.

Found a very good tutorial on how to do it right here:

http://csharp.net-informations.com/excel/csharp-create-excel.htm

Have added a reference to Microsoft Excel 16.0 Object library v1.9

However when I attempt to type in "excel" am getting no properties or methods for Excel, which I guess indicates I am using the wrong keyword.

Anyone know what I should be doing.

private void btnExcel_Click(object sender, EventArgs e)
{
    Excel. <- ??????        
} 
ScaryMinds
  • 335
  • 3
  • 11

2 Answers2

4

Did you add a using statement to the top of the file? See here for more information.

using Excel = Microsoft.Office.Interop.Excel;

Yusef
  • 306
  • 1
  • 5
2

It's called Namespace alias, You can achieve it in this way

using Excel = Microsoft.Office.Interop.Excel;
Nguyễn Văn Phong
  • 13,506
  • 17
  • 39
  • 56