Joshua needs to make all ordinal suffixes (st, nd, and rd) superscript. He has a macro that will do it in regular text, but if the ordinal suffixes are in tables, footnotes, or endnotes, they are ignored. Joshua wonders how he can make ordinal suffixes superscript regardless of where they appear in a document.
As you are typing a document, Word automatically makes ordinal suffixes into superscript. It is very possible, however, that Joshua is working with documents from others where the suffixes are not superscript, and it is these that he needs to change.
The key is to understand that Word documents consist of different "layers," for lack of a better term. The document elements that Joshua mentions, such as footnotes and endnotes, are on different layers. In VBA, these layers are called "stories," and if you want to affect the text within those stories, you need to step through them in your macro.
Something that Joshua mentioned should be pointed out here before looking at macros. He stated that ordinal suffixes that are in tables were not modified by his macro. If the table is within the main document text, then the macro should have worked on it. The only time it wouldn't is if the table is contained in a different story. For instance, if the table is in the endnotes, then it would be part of the endnote story. The fact it didn't work for Joshua would indicate that the table is, indeed, in a different story.
I have not seen Joshua's macro, but let's assume it is something similar to this:
Sub SuperscriptOrdinals()
Dim findList As Variant
Dim suffix As Variant
Dim rngSearch As Range
Dim rngSuffix As Range
findList = Array("st", "nd", "rd", "th")
For Each suffix In findList
Set rngSearch = ActiveDocument.Content
With rngSearch.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "[0-9]@" & suffix
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWildcards = True
Do While .Execute
Set rngSuffix = rngSearch.Duplicate
'Limit the range to the final two characters
rngSuffix.MoveStart Unit:=wdCharacter, _
Count:=rngSuffix.Characters.Count - 2
rngSuffix.Font.Superscript = True
'Continue searching after the ordinal just processed
rngSearch.Collapse Direction:=wdCollapseEnd
rngSearch.End = ActiveDocument.Content.End
Loop
End With
Next suffix
End Sub
The macro searches through the document and finds any number followed by one of the four ordinal suffixes. It then makes those suffixes superscript. The macro only checks the text in the main portion of the document, specified by the ActiveDocument.Content range. If you want to check the other stories, then you would need to modify the macro, similar to this:
Sub SuperscriptOrdinalsEverywhere()
Dim findList As Variant
Dim suffix As Variant
Dim firstStory As Range
Dim currentStory As Range
Dim rngSearch As Range
Dim rngSuffix As Range
Dim storyEnd As Long
findList = Array("st", "nd", "rd", "th")
For Each firstStory In ActiveDocument.StoryRanges
Set currentStory = firstStory
Do While Not currentStory Is Nothing
storyEnd = currentStory.End
For Each suffix In findList
Set rngSearch = currentStory.Duplicate
With rngSearch.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "[0-9]@" & suffix
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = True
Do While .Execute
Set rngSuffix = rngSearch.Duplicate
'Limit the range to the final two characters.
rngSuffix.MoveStart Unit:=wdCharacter, _
Count:=rngSuffix.Characters.Count - 2
rngSuffix.Font.Superscript = True
'Continue searching after the ordinal just processed.
rngSearch.Collapse Direction:=wdCollapseEnd
rngSearch.End = storyEnd
Loop
End With
Next suffix
Set currentStory = currentStory.NextStoryRange
Loop
Next firstStory
End Sub
Notice that the primary difference is that the macro steps through each story in the document and repeats the Find-and-Replace processing in each one, provided the story has content. This allows the macro to process not just the main document, but also footnotes, endnotes, headers, footers, comments, and other available stories.
Note, as well, that the macros in this tip assume that the ordinal suffixes used in the document are correct. If you want a macro to check for the appropriateness of a suffix (for instance, "llth" instead of "llst"), then the macro would be a good deal longer.
Note:
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (13986) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 365 applications with VBA programming. Written in clear terms and understandable language, the book includes systematic tutorials and contains both intermediate and advanced content for experienced VB developers. Designed to be comprehensive, the book addresses not just one Office application, but the entire Office suite. Check out Mastering VBA for Microsoft Office 365 today!
A common editorial need is to change the capitalization used on different words in a selection of text. Word provides a ...
Discover MoreNeed to get rid of direct, explicit formatting applied to a document? Here's an easy way to do it using familiar Word tools.
Discover MoreWhen adjusting the position of things on the Ruler (like tab stops), you can use the Alt key to get very precise in your ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
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 © 2026 Sharon Parq Associates, Inc.
Comments