How to capitalize the first letter after colon in a Word document?

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:

  1. Press ALT + F11 to open the Microsoft Visual Basic for Application window.
  2. 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:

How to capitalize the first letter after colon in a Word document

How to capitalize the first letter after colon in a Word document

We will be happy to hear your thoughts

Leave a reply

Gotkey.net
Logo
Compare items
  • Total (0)
Compare
0
Shopping cart