Formatting "Caps" in a Style

C

Compass Rose

Using Word 2007

Is it possible to include the changing of font case to Capitalize Each Word
in a paragraph style? I would like the text to appear as:

This Text Is In 'Capitalize Each Word' Case

I would also like to avoid the use of Shift+F3, if I can.

TIA
David
 
D

Doug Robbins - Word MVP

Word only has "paragraph" and "character" styles. There is no "word" style,
which is what you would need to achieve what you are after.

The following code will capitalize each word of the selected text:

Selection.Range.Case = wdTitleWord


--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my services on
a paid professional basis.
 
F

Fumei2 via OfficeKB.com

As Doug points out, you can not do this with a property of a Style itself.
However, if you have an explicit Style that you want to end up having Title
case, you could apply that Style and then use:

Sub ChangeTitlecase()
Dim r As Range
Set r = ActiveDocument.Range
With r.Find
.Style = "MyTitleCase"
Do While .Execute(Forward:=True) = True
r.Case = wdTitleWord
Loop
End With
End Sub

Assuming the Style is named MyTitleCase, the above goes through the document
changing all .Found instances of MyTitleCase to have in fact Titlecase.
Word only has "paragraph" and "character" styles. There is no "word" style,
which is what you would need to achieve what you are after.

The following code will capitalize each word of the selected text:

Selection.Range.Case = wdTitleWord
Using Word 2007
[quoted text clipped - 8 lines]
TIA
David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top