In this article, we would like to present you 3 methods to change the style of the first letter of specific words in your Word document.
One of the common rules of formatting a document is to capitalize the first letter of each sentence. But in some special cases, such as working on an artistic document, there are specific requirements we have to meet.
And in this post, we will show you 3 ways to change the style of the first letter of words according to 3 different demands.
Method 1: Change the Style of the First Letter of Each Word in a Document
- First and foremost, press “Alt+ F11” to invoke VBA editor in Word.
- Then click “Normal” on the left column.
- Next on the menu bar, click “Insert”.
- And click “Module” on drop-down menu.
- Now double click on new module to open it and paste following codes there:
Sub ChangeStyleOfFirstLetterInWords() Dim objWord As Range For Each objWord In ActiveDocument.Words ' Change the font size for the first letter in every word. objWord.Characters(1).Font.Size = 16 ' Set Bold font for the first letter in every word. objWord.Characters(1).Font.Bold = True ' Change the font color for the first letter in every word. objWord.Characters(1).Font.Color = wdColorGreen Next End Sub
- Finally, click “Run”.
Here is the outcome:
Notes:
-
Characters(1).Font.Size = 16
This sets the font size of first letter in 16. Change the number as you like.
-
Characters(1).Font.Bold = True
This line sets first letter in bold. You can change “True” to “False” if you don’t need.
-
Characters(1).Font.Color = wdColorGreen
This one applies green color to letter. Visit following link to choose your desired color: https://docs.microsoft.com/en-us/previous-versions/office/developer/office-2003/aa195614(v=office.11)
Method 2: Change the Style of the First Letter of First Word in All Sentences
- Firstly, install and run macro as shown in method 1.
- Then replace with this macro:
Sub ChangeStyleOfFirstLetterInSentence() Dim objSentence As Range For Each objSentence In ActiveDocument.Sentences ' Change the font size for the first letter in every sentence. objSentence.Words(1).Characters(1).Font.Size = 16 ' Set Bold font for the first letter in every sentence. objSentence.Words(1).Characters(1).Font.Bold = True ' Change the font color for the first letter in every sentence. objSentence.Words(1).Characters(1).Font.Color = wdColorGreen Next End Sub
Check the result:
Method 3: Change the Style of the First Letter of First Word in All Paragraphs
- Similarly, install and run a macro following steps in method 1.
- Next use this macro:
Sub ChangeStyleOfFirstLetterInParagraphs() Dim objParagraph As Word.Paragraph For Each objParagraph In ActiveDocument.Paragraphs ' Change the font size for the first letter in every paragraph. objParagraph.Range.Words(1).Characters(1).Font.Size = 16 ' Set Bold font for the first letter in every paragraph. objParagraph.Range.Words(1).Characters(1).Font.Bold = True ' Change the font color for the first letter in every paragraph. objParagraph.Range.Words(1).Characters(1).Font.Bold = True Next End Sub
See the screenshot:
Best Approach to Handling Data Loss
It can be very stressful to have critical data loss. Therefore, you must know how to deal with such a disaster. And of course, your best solution is to get hold of a doc repair utility. With it, you can get your data back in the least time.
Author Introduction:
Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including Excel repair and pdf repair software products. For more information visit www.datanumen.com
Leave a Reply