using System;
using Excel = Microsoft.Office.Interop.Excel;
namespace IndexedProperties
{
class Program
{
static void Main(string[] args)
{
CSharp2010();
//CSharp2008();
}
static void CSharp2010()
{
var excelApp = new Excel.Application();
excelApp.Workbooks.Add();
excelApp.Visible = true;
Excel.Range targetRange = excelApp.Range["A1"];
targetRange.Value = "Name";
}
static void CSharp2008()
{
var excelApp = new Excel.Application();
excelApp.Workbooks.Add(Type.Missing);
excelApp.Visible = true;
Excel.Range targetRange = excelApp.get_Range("A1", Type.Missing);
targetRange.set_Value(Type.Missing, "Name");
// Or
//targetRange.Value2 = "Name";
}
}
}