View Single Post
 
Old 08-26-2021, 06:47 PM
laith93 laith93 is offline Windows 10 Office 2019
Competent Performer
 
Join Date: Jul 2021
Posts: 117
laith93 is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
You can do this with find/replace and can also record it if you want it as a macro
Thank you so much, Mr. Andrew
You are the Best
Best Regards


Here is the macro code for one who concern:

Code:
Sub ReplaceCaptionStyle()
' Developed by Andrew Lockton (Guessed)
' Edited by laith93
' www.msofficeforums.com


' Showing all field codes (or by pressing Alt-F9):
    ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
    
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    ' Replace "CapTbl" with your own alternative caption style for tables
    Selection.Find.Replacement.Style = ActiveDocument.Styles("CapTbl")
    
    With Selection.Find
        .Text = "seq table"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchKashida = False
        .MatchDiacritics = False
        .MatchAlefHamza = False
        .MatchControl = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    
    
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    ' Replace "CapFig" with your own alternative caption style for figures
    Selection.Find.Replacement.Style = ActiveDocument.Styles("CapFig")
    
    With Selection.Find
        .Text = "seq figure"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchKashida = False
        .MatchDiacritics = False
        .MatchAlefHamza = False
        .MatchControl = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    
    ' Hiding all field codes (or by pressing Alt-F9):
    ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
End Sub
Reply With Quote