If you are looking for sequences like
Ref.[sup]2[/sup]
to replace with
Ref.2 (with the 2 superscripted)
then the following macro will do that. (
http://www.gmayor.com/installing_macro.htm)
Code:
Sub ReplaceSuperscript()
Dim oRng As Range
Const strList As String = "0123456789"
Set oRng = ActiveDocument.Range
With oRng.Find
Do While .Execute(FindText:="Ref.[sup]")
oRng.MoveEndUntil "]"
oRng.End = oRng.End + 1
oRng.Text = Replace(oRng.Text, "[sup]", "")
oRng.Text = Replace(oRng.Text, "[/sup]", "")
oRng.MoveStartUntil strList
oRng.Font.Superscript = True
oRng.Collapse 0
Loop
End With
lbl_Exit:
Exit Sub
End Sub
If however you want to find Ref. with a superscripted number following then
Code:
Sub FindSuperscript()
Dim oRng As Range
Const strList As String = "0123456789 "
Set oRng = ActiveDocument.Range
With oRng.Find
Do While .Execute(FindText:="Ref.")
oRng.MoveEndWhile strList
'Do something with the found text e.g.
oRng.HighlightColorIndex = wdYellow
oRng.Collapse 0
Loop
End With
lbl_Exit:
Exit Sub
End Sub
But in the latter case you will need to indicate what you want to do with the found reference.