' Load a Workbook
Dim workBook As Infragistics.Documents.Excel.Workbook =
Infragistics.Documents.Excel.Workbook.Load("C:\Book1.xls")
Dim sampleSheet As Infragistics.Documents.Excel.Worksheet = workBook.Worksheets(0)
' Define a Named Reference for a Cell
Dim namedRefCell As Infragistics.Documents.Excel.NamedReference = workBook.NamedReferences.Add("NamedReferenceCell", "=Sheet1!$B$5", sampleSheet)
MessageBox.Show(namedRefCell.ReferencedCell.ToString())
' Define a Named Reference for a Region
Dim namedRefRegion As Infragistics.Documents.Excel.NamedReference = workBook.NamedReferences.Add("NamedRefRegion", "=Sheet1!$A$5:$A$10", sampleSheet)
MessageBox.Show(namedRefRegion.ReferencedRegion.ToString())
' Define a Named Referene for Multiple Regions
Dim namedMultiRef As Infragistics.Documents.Excel.NamedReference = workBook.NamedReferences.Add("NamedMultiRegion", "=Sheet1!$A$1:$B$5,Sheet1!$D$5:$G$10", sampleSheet)
MessageBox.Show(namedMultiRef.ReferencedRegions(1).ToString())