Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 01-28-2021, 01:05 AM
macropod's Avatar
macropod macropod is offline find/replace wildcard expression help Windows 10 find/replace wildcard expression help 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

Perhaps:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim Rng As Range
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "<[A-Z0-9.\-]@[A-Z0-9.\-]@[DE]*>"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = False
    .MatchWildcards = True
  End With
  Do While .Find.Execute
    Set Rng = .Duplicate
    With Rng
      .End = .Paragraphs(1).Range.End - 1
      .End = .Start + Len(Split(.Text, " ")(0))
      .Collapse wdCollapseEnd
      .End = .Paragraphs(1).Range.End - 1
      If UBound(Split(.Text, " ")) > 1 Then
        If Split(.Text, " ")(1) = "REV" Then .End = .Start + 10
      End If
    End With
    .End = Rng.End
    .Font.Bold = True
    .Collapse wdCollapseEnd
  Loop
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help With Find and Replace Wildcard rsrasc Word VBA 9 10-13-2015 02:37 PM
find/replace wildcard expression help Wildcard Find and Replace anomaly BruceM Word 3 07-10-2015 04:33 AM
find/replace wildcard expression help New Find/Replace Wildcard Needed rsrasc Word VBA 2 11-11-2014 09:46 AM
find/replace wildcard expression help Wildcard Find and Replace Ulodesk Word 1 06-23-2014 10:26 AM
find/replace wildcard expression help Need help using WildCard Find & Replace Cayce Word 1 06-09-2014 04:17 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:30 PM.


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