Home > DeveloperSection > Forums > Microsoft.Office.Interop.Excel.ApplicationClass has no constructor defined
Jeet Verma
Jeet Verma

Total Post:110

Points:776
Posted on    November-14-2013 3:21 AM

 C# C# 
Ratings:


 1 Reply(s)
 6973  View(s)
Rate this:

I tried to follow How to open an Excel file in C# tutorial, i.e. added a reference on the Com tab to Microsoft Office 14.0 Object Library and tried to compile code:

using Excel = Microsoft.Office.Interop.Excel;

//...

Excel.Application xlApp;

Excel.Workbook xlWorkBook;

Excel.Worksheet xlWorkSheet;

xlApp = new Excel.ApplicationClass();//error here

//...

and faced a compile-time error, saying

There is no constructor defined for Microsoft.Office.Interop.Excel.ApplicationClass type.

What am I missing?



ezra heywood
ezra heywood

Total Post:145

Points:1019
Posted on    November-14-2013 4:50 AM

Hi Jeet,

Use the following to open it:

xlApp = CreateObject("Excel.Application");

CreateObject creates and returns a reference to a COM object

Don't want to miss updates? Please click the below button!

Follow MindStick