If you need to capitalize the first letter after a colon in a Word document, manually changing each letter is not an efficient option. This article will guide you on how to quickly convert the first letter after a colon to uppercase.
Capitalize the first letter after a colon using VBA code in Word
The following VBA code can help you capitalize all the first letters after a colon in the entire Word document at once. Please follow these steps:
- Press ALT + F11 to open the Microsoft Visual Basic for Application window.
- Click on Insert > Module and paste the following code into the Module window.
Sub CapitalizeWordAfterColon()
Application.ScreenUpdating = False
Selection.HomeKey wdStory
With Selection.Find
.ClearFormatting
.Text = “: ([a-z])”
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchWholeWord = False
.MatchSoundsLike = False
.MatchCase = False
.MatchWildcards = True
.MatchAllWordForms = False
With .Replacement.Font
.AllCaps = True
.SmallCaps = False
End With
End With
Selection.Find.Execute Replace:=wdReplaceAll
Application.ScreenUpdating = True
End Sub
Press F5 to run this code, and all the first letters after a colon will be converted to uppercase at once, as shown in the screenshot: