View Single Post
 
Old 06-29-2022, 12:19 AM
Bikram Bikram is offline Windows 10 Office 2007
Advanced Beginner
 
Join Date: Jul 2021
Location: Nepal
Posts: 97
Bikram is on a distinguished road
Default

Try:
Code:
Sub SubscriptPara()
    Selection.HomeKey Unit:=wdStory, Extend:=wdMove
    Dim a As String
    With Selection.find
        .ClearFormatting
        .Replacement.ClearFormatting
        With .Replacement.font
            .Bold = True
            .Color = vbBlack
            .Superscript = True
            .Size = 10
        End With
        
        .Text = "[0-9]{1,} "
        .Replacement.Text = "^&"
        .Forward = True
        .Wrap = wdFindContinue
        .format = True
        .MatchWildcards = True
    Do While .Execute = True
        a = MsgBox("Do you want the selection to be subscriptted?", vbYesNoCancel)
        If a = vbYes Then
            .Execute Replace:=wdReplaceOne
        ElseIf a = vbNo Then
            .Execute
        Else
            Exit Sub
        End If
    Loop
    End With
End Sub
Reply With Quote