Word: Change case after a period

February 2, 2012

I couldn’t find an easy way to change the case of a lower case letter after a period using Find/Replace (see Matthew’s 25 January 2012 comment on this blog post). My wildcard skills just aren’t sophisticated enough!

However, I did a bit of hunting on the internet and found a couple of macros. I modified them slightly and this one below is the result.

Full kudos for this macro goes to and DonMacnaughto and Lene Fredborg (http://www.microsoft-word-answers.com/microsoft/Word-VBA/29231545/repeatedly-change-first-letter-after-periodblank-to-uppercase.aspx).

Please note: Be sure that this is what you want to do. I suggest you think about it before trying it (and make a backup of your document!), as it will convert ANY letter after a period followed by a space to a capital letter. While that may be fine in most circumstances, you’ll need to watch for things like ‘e.g.’, ‘i.e.’, ‘etc.’, and any abbreviation/acronym that has periods, for example. Make sure that’s what you want.

Sub ChangeCaseAfterPeriod()

With ActiveDocument.Content.Find
   .Text = ". "
   .Forward = True
   .Wrap = wdFindStop
   .Format = False
   .MatchCase = False
   .MatchWholeWord = False
   .MatchWildcards = False
   .MatchSoundsLike = False
   .MatchAllWordForms = False

Do While .Execute = True
With .Parent
'Include the next character
   .End = .End + 1
'Change to uppercase
   .Case = wdUpperCase
'Make sure to move on to next ". "
   .Start = .End
End With
End With

End Sub

[Links last checked January 2012]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: