Case Property

Microsoft Word Visual Basic

Show All

Case Property

       

Returns or sets a WdCharacterCase constant that represents the case of the text in the specified range. Read/write.

WdCharacterCase can be one of these WdCharacterCase constants.
wdFullWidth
wdHalfWidth
wdHiragana
wdKatakana
wdLowerCase
wdNextCase
wdTitleSentence
wdTitleWord
wdToggleCase
wdUpperCase

expression.Case

expression   Required. An expression that returns a Range object.

Remarks

Some of the constants listed above may not be available to you, depending on the language support (U.S. English, for example) that you’ve selected or installed.

Example

This example changes the first word in the selection to uppercase.

Selection.Words(1).Case = wdUpperCase

This example capitalizes the first letter of each sentence in the first paragraph of the document.

Set myRange = ActiveDocument.Paragraphs(1).Range
For Each Sent In myRange.Sentences
    Sent.Case = wdTitleSentence
Next Sent