Bookmark.SortAscending Method (2007 System)

Sorts paragraphs or table rows in ascending alphanumeric order within a Bookmark control.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)

Syntax

'Declaration
Public Sub SortAscending
'Usage
Dim instance As Bookmark

instance.SortAscending()
public void SortAscending()
public:
void SortAscending()
public function SortAscending()

Remarks

The first paragraph or table row is considered a header record and is not included in the sort. Use the Sort(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object) method to include the header record in a sort.

This method offers a simplified form of sorting intended for mail merge data sources that contain columns of data. For most sorting tasks, use the Sort(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object) method.

This method displays a Header Record Delimiters dialog box where users must select a field delimiter.

Examples

The following code example adds a list of fruits to a Bookmark control and then sorts the list in ascending order.

This example is for a document-level customization.

Private Sub BookmarkSortAscending()

    Me.Paragraphs(1).Range.InsertParagraphBefore()

    Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
        Me.Controls.AddBookmark(Me.Paragraphs(1).Range, "Bookmark1")
    Bookmark1.Text = "Fruit" & vbLf & "Oranges" & vbLf & "Bananas" _
        & vbLf & "Apples" & vbLf & "Pears"
    Bookmark1.SortAscending()

End Sub
private void BookmarkSortAscending()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();

    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");
    bookmark1.Text = "Fruit" + "\n" + "Oranges" + "\n" +
        "Bananas" + "\n" + "Apples" + "\n" + "Pears";
    bookmark1.SortAscending();
}

.NET Framework Security

See Also

Reference

Bookmark Class

Bookmark Members

Microsoft.Office.Tools.Word Namespace