Syntax
ChangeCase [Type]
ChangeCase()
Remarks
The ChangeCase statement sets the case of the selected text to sentence case, lowercase, uppercase, or initial capital letters. ChangeCase does not change the character formats associated with the selected text, as do the SmallCaps and AllCaps statements. ChangeCase corresponds to the Change Case command (Format menu).
Argument | Explanation | |
Type | Specifies the change in case: Omitted If the selection is one sentence or less, alternates the case of the selection among all lowercase, all uppercase, and initial capital letters. If the selection is more than one sentence, alternates among all lowercase, all uppercase, and sentence case. 0 (zero) Sets the text to all lowercase 1 Sets the text to all uppercase 2 Capitalizes the first letter of each selected word 3 Capitalizes the first letter of the selection 4 Capitalizes the first letter of each selected sentence 5 Toggles the case of each selected letter (for example, "Word" becomes "wORD") |
If there is no selection, Word selects the word nearest the insertion point, and then changes the case of the selected word.
The ChangeCase() function returns the following values.
Value | Explanation | |
0 (zero) | If none of the selected text is in uppercase | |
1 | If all of the selected text is in uppercase | |
2 | If the text is in a mixture of uppercase and lowercase |
Example
This example selects the current paragraph (using the predefined bookmark "\ Para") and capitalizes the first letter of each sentence:
EditGoTo "\Para" ChangeCase 4
See Also
AllCaps, FormatChangeCase, LCase$(), SmallCaps, UCase$()