• 0

Diving into C#/Excel, one issue with the application class


Question

Hi guys, I'm trying to mess with excel and C#. So far so good the only thing I can't seem to get past though is a simple problem of Visual studio keeps saying "Type Microsoft.Office.Interop.Excel.ApplicationClass can not be embedded".

public void AutoDetect()
{
Excel.Application xlApp;
			Excel.Workbook xlWorkBook;
			Excel.Worksheet xlWorkSheet;
			object misValue = System.Reflection.Missing.Value;

			xlApp = new Excel.ApplicationClass();
			xlWorkBook = xlApp.Workbooks.Open("csharp.net-informations.xls", 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
			xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
...

What am I doing wrong? Is there a workaround to this?

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

I've done something similar before, but I'm pretty sure I didn't use "ApplicationClass()" to instantiate an Excel Application object.

I've not got Visual Studio on the computer I'm on, so I can't provide any more help at the moment, but if this is still unanswered tomorrow, I'll reply with how I did what you want to do.

Rob

Link to comment
Share on other sites

This topic is now closed to further replies.