Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Gets or sets the formula label type for the NamedRange control.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
Syntax
'Declaration
Property FormulaLabel As XlFormulaLabel
Get
Set
XlFormulaLabel FormulaLabel { get; set; }
Property Value
Type: Microsoft.Office.Interop.Excel.XlFormulaLabel
One of the XlFormulaLabel values.
Remarks
The return value of this property can be xlNone if the NamedRange control contains no labels, or one of the following XlFormulaLabel values:
Examples
The following code example uses the FormulaLabel property to specify that column labels can be used in formulas, and then creates a formula that uses a column label in a NamedRange.
This example is for a document-level customization.
Private Sub ShowFormulaLabel()
Globals.ThisWorkbook.AcceptLabelsInFormulas = True
Dim namedRange1 As Microsoft.Office.Tools.Excel.NamedRange _
= Me.Controls.AddNamedRange(Me.Range("A1", "A4"), _
"formualArrayRange")
namedRange1.FormulaLabel = Excel.XlFormulaLabel.xlColumnLabels
Me.Range("A1").Value2 = "Product Sales"
Me.Range("A2").Value2 = 11
Me.Range("A3").Value2 = 22
Me.Range("A4").Formula = "=Sum(Product Sales)"
End Sub
private void ShowFormulaLabel()
{
Globals.ThisWorkbook.AcceptLabelsInFormulas = true;
Microsoft.Office.Tools.Excel.NamedRange namedRange1 =
this.Controls.AddNamedRange(this.Range["A1", "A4"],
"formualArrayRange");
namedRange1.FormulaLabel =
Excel.XlFormulaLabel.xlColumnLabels;
this.Range["A1", missing].Value2 = "Product Sales";
this.Range["A2", missing].Value2 = 11;
this.Range["A3", missing].Value2 = 22;
this.Range["A4", missing].Formula = "=Sum(Product Sales)";
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.