Edit

Share via


Selection.SortByHeadings Method

Definition

Sorts the headings in the specified selection.

public void SortByHeadings (ref object SortFieldType, ref object SortOrder, ref object CaseSensitive, ref object BidiSort, ref object IgnoreThe, ref object IgnoreKashida, ref object IgnoreDiacritics, ref object IgnoreHe, ref object LanguageID);
abstract member SortByHeadings : obj * obj * obj * obj * obj * obj * obj * obj * obj -> unit
Public Sub SortByHeadings (Optional ByRef SortFieldType As Object, Optional ByRef SortOrder As Object, Optional ByRef CaseSensitive As Object, Optional ByRef BidiSort As Object, Optional ByRef IgnoreThe As Object, Optional ByRef IgnoreKashida As Object, Optional ByRef IgnoreDiacritics As Object, Optional ByRef IgnoreHe As Object, Optional ByRef LanguageID As Object)

Parameters

SortFieldType
Object

The sort field type to use. Can be one of the WdSortFieldType constants. The default value is wdSortFieldAlphanumeric. Depending on the language support (U.S. English, for example) that you have selected or installed, some of these constants may not be available to you.

SortOrder
Object

The sorting order to use. Can be one of the WdSortOrder WdSortOrder constants.

CaseSensitive
Object

True to sort with case sensitivity. The default value is False.

BidiSort
Object

True to sort based on right-to-left language rules. Depending on the language support (U.S. English, for example) that you have selected or installed, this parameter may not be available to you.

IgnoreThe
Object

True to ignore the Arabic character alef lam when sorting right-to-left language text. Depending on the language support (U.S. English, for example) that you have selected or installed, this parameter may not be available to you.

IgnoreKashida
Object

True to ignore kashidas when sorting right-to-left language text. Depending on the language support (U.S. English, for example) that you have selected or installed, this parameter may not be available to you.

IgnoreDiacritics
Object

True to ignore bidirectional control characters when sorting right-to-left language text. Depending on the language support (U.S. English, for example) that you have selected or installed, this parameter may not be available to you.

IgnoreHe
Object

True to ignore the Hebrew character he when sorting right-to-left language text. Depending on the language support (U.S. English, for example) that you have selected or installed, this parameter may not be available to you.

LanguageID
Object

Specifies the sorting language. Can be one of the WdLanguageID constants.

Remarks

Use the Selection property to return the Selection object. If no object qualifier is used with the Selection property, Word returns the selection from the active pane of the active document window.

Even when a selection is collapsed to an insertion point, it is not necessarily empty. For example, the Text property will still return the character to the right of the insertion point; this character also appears in the Characters collection of the Selection object. However, calling methods like Cut or Copy from a collapsed selection causes an error.

It is possible for the user to select a region in a document that does not represent contiguous text (for example, when using the ALT key with the mouse). Because the behavior of such a selection can be unpredictable, you may want to include a step in your code that checks the Type property of a selection before performing any operations on it (Selection.Type = wdSelectionBlock). Similarly, selections that include table cells can also lead to unpredictable behavior. The Information property will tell you if a selection is inside a table (Selection.Information(wdWithinTable) = True).

Because Range objects share many of the same methods and properties as Selection objects, using Range objects is preferable for manipulating a document when there is not a reason to physically change the current selection. For more information about Selection and Range objects, see Working with the Selection Object and Working with Range Objects in the Visual Basic for Applications (VBA) documentation.

Applies to