View Single Post
 
Old 06-28-2022, 04:25 PM
jeffreybrown jeffreybrown is offline Windows 10 Office 2016
Expert
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default VBA to find and replace but ask to continue

I currently use this code to Subscript certain areas of my document, but it has been updating areas I don't need subscipted. How can I have the macro ask me if that paragraph should have the numbers subscripted?

Code:
Sub SubscriptPara()
    Selection.HomeKey Unit:=wdStory, Extend:=wdMove
    
    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 = "^&"
        .Execute Replace:=wdReplaceAll

        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchWildcards = True
    End With
End Sub
Reply With Quote