Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

NamedRange.Parse Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Parses a range of data and breaks it into multiple cells.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
Object Parse(
	Object ParseLine,
	Object Destination


Type: System.Object

A string that contains left and right brackets to indicate where the cells should be split.

For example, "[xxx][xxx]" would insert the first three characters into the first column of the destination range, and it would insert the next three characters into the second column.

If this argument is omitted, Microsoft Office Excel guesses where to split the columns based on the spacing of the top left cell in the range. If you want to use a different range to guess the parse line, use a Microsoft.Office.Interop.Excel.Range object as the ParseLine argument. That range must be one of the cells that is being parsed. The ParseLine argument cannot be longer than 255 characters, including the brackets and spaces.

Type: System.Object

A Microsoft.Office.Interop.Excel.Range object that represents the upper-left corner of the destination range for the parsed data. If this argument is omitted, Excel parses in place.

Return Value

Type: System.Object

Distributes the contents of the NamedRange control to fill several adjacent columns. The NamedRange control can be no more than one column wide.

The following code example uses the Parse method to parse each group of digits in a set of telephone numbers from a NamedRange control named NamedRange1 into a new range of cells starting at cell D1.

This example is for a document-level customization.

private void ParsePhoneNumbers()
    this.Range["A1"].Value2 = "'5555550100'";
    this.Range["A2"].Value2 = "'2065550101'";
    this.Range["A3"].Value2 = "'4255550102'";
    this.Range["A4"].Value2 = "'4155550103'";
    this.Range["A5"].Value2 = "'5105550104'";

    Microsoft.Office.Tools.Excel.NamedRange namedRange1 =
        this.Controls.AddNamedRange(this.Range["A1", "A5"],

    // Parse the phone numbers and insert them into  
    // the range starting at D1.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.