Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-02-2022, 03:04 PM
macropod's Avatar
macropod macropod is offline find and replace with format Windows 10 find and replace with format Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default


Try:
Code:
Sub etalnew()
Application.ScreenUpdating = False
Options.DefaultHighlightColorIndex = wdDarkYellow
Dim rngStory As Range
For Each rngStory In ActiveDocument.StoryRanges   
  With rngStory.Find
    .Text = "<et al>"
    .Replacement.Text = "et^sal"
    .Replacement.Highlight = True
    .Replacement.Font.Italic = True
    .Wrap = wdFindContinue
    .MatchWildcards = True
    .Execute Replace:=wdReplaceAll
  End With
Next rngStory
Application.ScreenUpdating = True
End Sub
Do note that textboxes, for example, won't be processed by such code and that Find/Replace is a bit flakey with page headers & footers. If you have 'et al' in any of those, you might need different code. See: Using a Macro to Replace Text Wherever It Appears in a Document
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
find and replace with format find/replace date format improvement? LQuinn Word VBA 2 05-14-2021 11:15 PM
Find/Replace using format of cell catflap Excel 1 09-11-2017 07:28 AM
find and replace with format Find and Replace maintain format winningson Word 3 01-19-2013 05:38 AM
find and replace with format Find and Replace Format macro issue Jack Word VBA 2 12-12-2012 09:24 PM
find and replace with format Bad view when using Find and Find & Replace - Word places found string on top line paulkaye Word 4 12-06-2011 11:05 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:19 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