Partager via


NamedRange.NumberFormatLocal Property

Definition

Gets or sets the format code for the NamedRange control in the language of the user.

public:
 property System::Object ^ NumberFormatLocal { System::Object ^ get(); void set(System::Object ^ value); };
public object NumberFormatLocal { get; set; }
member this.NumberFormatLocal : obj with get, set
Public Property NumberFormatLocal As Object

Property Value

The format code for the NamedRange control in the language of the user.

Examples

The following code example uses the NumberFormat property to format a date string in a NamedRange. The example also uses the NumberFormatLocal property to display the date format in the language of the user.

This example is for a document-level customization.

Microsoft.Office.Tools.Excel.NamedRange formatRange;
private void ApplyNumberFormatting()
{
    formatRange = this.Controls.AddNamedRange(
         this.Range["C1"], "formatRange");

    this.formatRange.Value2 = "4-Apr-1974";
    this.formatRange.NumberFormat = "m/d/yyyy";

    // Display the number format in the language of the user.
    MessageBox.Show("The number format for the NamedRange is: " +
        this.formatRange.NumberFormatLocal.ToString());
}
Private formatRange As Microsoft.Office.Tools.Excel.NamedRange

Private Sub ApplyNumberFormatting()
    formatRange = Me.Controls.AddNamedRange( _
        Me.Range("C1"), "formatRange")

    Me.formatRange.Value2 = "4-Apr-1974"
    Me.formatRange.NumberFormat = "m/d/yyyy"

    ' Display the number format in the language of the user.
    MessageBox.Show("The number format for the NamedRange is: " & _
        Me.formatRange.NumberFormatLocal.ToString())
End Sub

Remarks

The Format function uses different format code strings than do the NumberFormat and NumberFormatLocal properties.

Applies to