Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 06-29-2022, 12:19 AM
Bikram Bikram is offline VBA to find and replace but ask to continue Windows 10 VBA to find and replace but ask to continue 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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you use the find and replace tool to find dates and times in Excel 2013? Jules90 Excel 3 04-14-2020 07:40 PM
In Find and Replace, can Word stop after each Replace? wardw Word 1 06-08-2017 02:47 PM
VBA to find and replace but ask to continue Find what box in Find and replace limits the length of a search term Hoxton118 Word VBA 7 06-10-2014 05:05 AM
VBA to find and replace but ask to continue Bad view when using Find and Find & Replace - Word places found string on top line paulkaye Word 4 12-06-2011 11:05 PM
VBA to find and replace but ask to continue Help with find and replace or query and replace shabbaranks Excel 4 03-19-2011 08:38 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:12 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft