1 out of 7 rated this helpful - Rate this topic

ApplicationClass Class 

This class supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Namespace: Microsoft.Office.Interop.Excel
Assembly: Microsoft.Office.Interop.Excel (in microsoft.office.interop.excel.dll)

'Usage
Dim applicationClass1 As New ApplicationClass()
public class ApplicationClass : _Application, Application, AppEvents_Event
public class ApplicationClass implements _Application, Application, AppEvents_Event
public class ApplicationClass implements _Application, , Application, , AppEvents_Event
System.Object
  Microsoft.Office.Interop.Excel.ApplicationClass
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, and Windows 2000

Target Platforms

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Application
You're meant to use Application rather than ApplicationClass.
Excel Automation in VB.NET

Here is VB.NET sample code:

Dim excelApp As ApplicationClass = New ApplicationClass
Dim excelBook As Workbook
excelBook = excelApp.Workbooks.Open("C:\SampleExcel.xls", 0, False, 5, _
System.Reflection.Missing.Value, System.Reflection.Missing.Value, _
False, System.Reflection.Missing.Value, System.Reflection.Missing.Value, _
True, False, System.Reflection.Missing.Value, False)

Dim excelSheets As Sheets = excelBook.Sheets
Dim wSheet As Worksheet = excelSheets(1)
Dim cell1 As Range = wSheet.Range("B4:FZ4", Type.Missing)
Dim cell2 As Range = wSheet.Range("A4:A5", Type.Missing)
cell2.Value2 = "SampleText"

excelBook.Save()
excelApp.Quit()

Excel Automation in C#

Here is an example of how to use ApplicationClass to generate Excel sheet and data in C#.

Excel.Application xl=new Excel.ApplicationClass();
Excel.Workbook wb=xl.Workbooks.Open(Environment.CurrentDirectory+"/SampleExcel.xls",0, false, 5, System.Reflection.Missing.Value, System.Reflection.Missing.Value, false, System.Reflection.Missing.Value, System.Reflection.Missing.Value,true, false, System.Reflection.Missing.Value, false, false, false);//Open the excel sheet

Excel.Sheets xlsheets = wb.Sheets; //Get the sheets from workbook
Excel.Worksheet excelWorksheet = (Excel.Worksheet)xlsheets[1]; //Select the first sheet
Excel.Range excelCell = (Excel.Range)excelWorksheet.get_Range("B4:FZ4", Type.Missing); //Select a range of cells
Excel.Range excelCell2 = (Excel.Range)excelWorksheet.get_Range("A5:A5", Type.Missing); //Select a single cell
excelCell2.Cells.Value2 = "SampleText"; //Assign a value to the cell
wb.Save(); //Save the workbook

xl.Quit();

=========

Read more details here:

http://www.c-sharpcorner.com/UploadFile/thiagu304/ExcelAutomation01052007080910AM/ExcelAutomation.aspx