Microsoft Office Tutorials and References
In Depth Information
Named ranges
missing, missing, missing, missing, missing, missing,
missing, missing, missing, missing, missing, missing,
missing, missing, missing, missing, missing, missing,
missing, missing, missing, missing, missing, missing,
missing, missing);
// Writing the new range using the union operation
AuthorRange3.Value2 = "Programming VSTO Book";
}
Named ranges
Named ranges are used as replacements for the columns of numbers in Excel
spreadsheet. You can use a more indicative name to refer to a column of numbers.
Such ranges are known as Named ranges.
Open Visual Studio 2008 and create a new solution, as usual. Write the following
code inside the Sheet1.cs file:
// Instance of the NamedRange Class
Microsoft.Office.Tools.Excel.NamedRange AuthorNamedRange = null;
private void Sheet1_Startup(object sender, System.EventArgs e)
{
// Setting range of cells from E1 to G1
Excel.Range AuthorRange = this.Range["E1", "G1"];
// Setting the range name for cells
AuthorNamedRange = this.Controls.AddNamedRange(AuthorRange,
"AuthorCells");
// Updating the values in the cell
AuthorNamedRange.Value2 = "VSTO - My First Book";
}
 
Search JabSto ::




Custom Search