You have a Word document where one or more authors have variously used upper and lower case for the first letter of the first word after a colon (e.g. Note: This… and Note: this… ). For consistency and compliance with your style guide, you want to capitalize every initial letter immediately following a colon.
Run a macro to make the first letter after a colon a capital letter.
The critical parts of this find/replace macro are:
- .Text = “: ([a-z])” — Word looks for a colon followed by a space, then a wildcard command for any lower case letter
- .MatchWildcards = True — Word treats the .Text values in the parentheses as a wildcard string
- Selection.Range.Case = wdUpperCase — When a lower case letter after a colon and a space is found, Word changes it to upper case.
Macro to capitalize the first letter after a colon
Sub CapsAfterColon() With Selection.Find .ClearFormatting .Text = ": ([a-z])" .Forward = True .Wrap = wdFindContinue .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = True .MatchSoundsLike = False .MatchAllWordForms = False .Execute While .Found Selection.Range.Case = wdUpperCase Selection.Collapse Direction:=wdCollapseEnd .Execute Wend End With End Sub
If always you want the first letter after a colon and space to be in lower case, make these changes to this macro:
- .Text = “: ([A-Z])” — Word looks for a colon followed by a space, then a wildcard command for any upper case letter
- Selection.Range.Case = wdLowerCase — When an upper case letter after a colon and a space is found, Word changes it to lower case.
If a macro is too scary for you, you can partially run this as a Find/Replace action. Type : ([a-z]) in the Find field, click More and select Match Wildcards, then click Find Next to find the first instance. You can then change each found word’s initial letter to upper case, one at a time.
[Links last checked June 2011; this macro is a modification of one from Allen Wyatt’s Word VBA Guidebook (http://store.tips.net/T010353_Word_VBA_Guidebook_Table_of_Contents.html)]