Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 06-29-2021, 05:20 PM
macropod's Avatar
macropod macropod is offline Find What Text (^&) is not working for find Italic formatted strings Windows 10 Find What Text (^&) is not working for find Italic formatted strings 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

You could achieve the desired effect with 'Track Changes' using a macro such as:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim i As Long
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = ""
    .Replacement.Text = ""
    .Font.Italic = True
    .Forward = True
    .Wrap = wdFindStop
    .Format = True
  End With
  Do While .Find.Execute
    i = i + 1
    .InsertBefore "("
    With .Duplicate
      .Collapse wdCollapseEnd
      .Text = ")"
      .Font.Italic = False
    End With
    If .Information(wdWithInTable) = True Then
      If .End = .Cells(1).Range.End - 1 Then
        .End = .Cells(1).Range.End
        .Collapse wdCollapseEnd
        If .Information(wdAtEndOfRowMarker) = True Then
          .End = .End + 1
        End If
      End If
    End If
    .Collapse wdCollapseEnd
    If (ActiveDocument.Range.End - .End) < 2 Then Exit Do
  Loop
End With
Application.ScreenUpdating = True
MsgBox i & " instances found."
End Sub
For PC macro installation & usage instructions, see: Installing Macros
For Mac macro installation & usage instructions, see: Word:mac - Install a Macro
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 

Tags
find and replace, find what text

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find What Text (^&amp;) is not working for find Italic formatted strings Find text, format part of text in italic d4okeefe Word VBA 18 06-30-2022 11:35 PM
Find What Text (^&amp;) is not working for find Italic formatted strings How to do a pre-formatted find & replace paik1002 Word VBA 5 03-10-2016 10:50 PM
Find What Text (^&amp;) is not working for find Italic formatted strings VBA Word - Find Formatted Text Version Only - Replace From Table jc491 Word VBA 14 01-06-2016 08:57 PM
Find What Text (^&amp;) is not working for find Italic formatted strings Find where find text contains a double quote norgro Word VBA 1 01-23-2015 10:58 PM
Find and replace inside strings containing various names audioman Word VBA 4 03-25-2014 11:19 AM

Other Forums: Access Forums

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