PDA

View Full Version : How to find ordinals (1st, 2nd, 3rd, ...)



AlexandarR
07-24-2015, 08:45 AM
Hi!

I have to find ordinals like 1st, 2nd, 3rd, 4th, ..., in which the text part "st", "nd", "rd", "th" is in superscript.
And a comment has to be inserted like below:
"ordinals" should be online [EX: 10th, 1st, 3rd]

Please help!

Thanks in advance!

Alex

gmaxey
07-24-2015, 01:29 PM
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oRng As Word.Range
Set oRng = ActiveDocument.Range
With oRng.Find
.Font.Superscript = True
While .Execute
Select Case oRng.Text
Case "st", "nd", "rd", "th"
oRng.Comments.Add oRng, "Ordinals should be regular text"
End Select
oRng.Collapse wdCollapseEnd
Wend
End With
lbl_Exit:
Exit Sub
End Sub

AlexandarR
07-27-2015, 06:40 AM
Thank you very much! It works fine.

Regards
Alex

gmaxey
07-27-2015, 09:56 AM
Glad to help.