Using VBA in Word to find and format ordinal ranks with superscript
<p>I am working in Microsoft Word and need VBA to find and format specific text as superscript. I am trying to format the following text as superscript, but only if the text immediately follows a number. Here's the four pieces of text I would need to find:</p>

<p>st
nd
rd
th</p>

<p>Here's an example: </p>

<p><em>Bill was 1st in the race, but was followed closely by the second place finisher, Steve.</em></p>

<p>After applying the code to this example, the "st" of 1st would be formatted as a superscript, but the "nd" in second would be untouched.  </p>

<p>Below is the code I am working with, but I can't seem to get it to work.</p>

<pre><code>Sub ReplaceOrdinals()

ActiveDocument.Range.Select

Dim regExp As Object
Set regExp = CreateObject("vbscript.regexp")

With regExp
    .Pattern = "(?&lt;=[0-9])[dhnrst]{2}"
    .Global = True
    Selection.Font.Superscript = wdToggle
End With

End Sub
</code></pre>