Written by Allen Wyatt (last updated March 25, 2023)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021
Marcela has a document in which there are many instances of phrases such as "century XXI" where the only thing that changes is the Roman numerals. She would like all instances of Roman numerals following the word "century" to be converted to lowercase small caps. (This is necessary so that the small caps look correct.) Marcela wonders if there is a way to do this using Find and Replace.
When you format text as small caps, anything that is a capital letter looks the same as the unformatted version of the text. Anything that is lowercase, however, looks like a "small" version of a capital letter. Thus, the name small caps. (See Figure 1.)
Figure 1. Text showing effect of small caps on uppercase and lowercase letters (XXI).
This difference in how uppercase and lowercase is displayed by small caps is why Marcela indicated that she needed to both convert the Roman numerals to lowercase and format them as small caps.
Unfortunately, there is no ability within Find and Replace to change the case of letters. You can easily use a wildcard search to apply the Small Caps attribute to the Roman numerals, but not to change them to lowercase. In order to do that, you will need to use a macro:
Sub ConvertRomans() Dim aRange As Range Set aRange = ActiveDocument.Range With aRange.Find .ClearFormatting .MatchWildcards = True .Text = "century [MDCLXVI]{1,}>" Do While .Execute With aRange .MoveStart Unit:=wdWord, Count:=1 .Text = LCase(aRange.Text) .Font.SmallCaps = True .Collapse direction:=wdCollapseEnd End With Loop End With End Sub
This macro uses a wildcard search to find any instances of "century" followed by Roman numerals. If an instance is located, then the word "century" is excluded from the range that was found, meaning that only the Roman numerals remain. These are then converted to lowercase and the Small Caps attribute applied. The search continues, until such point as nothing more is found. (The macro runs very quickly, even in large documents.)
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (7853) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021.
Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!
When you record a macro, Word very literally records what you do. This includes filling in various settings in dialog ...
Discover MoreWant to print your macros to hard copy? There are a few approaches you can use to accomplish the task, as discussed in ...
Discover MoreDeclaring variables in a macro is good programming practice. Here’s how to do it and how to make sure they are all ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
2023-03-25 23:45:41
Tomek
Correction to my post of 2023-03-25 23:42:01: In the search term there is no space in the front; I replaced it with < for more robustness.
2023-03-25 23:42:01
Tomek
In case the macro based solution is not acceptable, (e.g., when the IT department blocks macros), may be the following approach would work :
1. Press Ctrl+H. Word displays the Replace tab of the Find and Replace dialog box.
2. Select the Find Tab.
3. In Find What: box type in "<[MDCLXVI]{1,}>" (without quotation marks, note the space in the front).
4. Check the "Use Wildcards" box.
5. Click on the button "Find In ▼" and select "Main Document". (see Figure 1 below) . This will select all occurrences of roman numerals (in capital letters, and separated from the text by spaces or other word delimiters; this is because of < and > in the find term.
6. Close the Find Dialog box.
7. Use the keyboard shortcut Shift-F3 to convert all the selected pieces of text to lowercase.
8. While the roman numerals are still selected, press Ctrl-D (or select Font down-arrow from the Home Tab on the ribbon). In the Font dialog box, select the Small caps check-box and clickOK.
That should do it. It looks harder in description than it really is.
NOTE: This approach depends on the roman numerals being capitalized and looking like a word. Beware, the process will convert some all-capitalized words, like MIX, CIVIL, MILD, etc., and in particular I into small caps. The last one (I) should be caught by the spelling checker though. For the rest of potential words, you may want to review for them while the affected text is still highlighted. Alternatively you may search for
"century [MDCLXVI]{1,}>", change it all into lowercase (Shift-F3 twice), and Small caps, then search for all occurrences of the word "century" and revert to normal font.
Figure 1.
Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments