Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-24-2019, 06:33 AM
gmaxey gmaxey is offline I am trying to delete text of any format between two bold, recurring keywords or symbols Windows 10 I am trying to delete text of any format between two bold, recurring keywords or symbols Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

You can also do this using a nested .Find method:



Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oRng As Range, oRngE As Range
  Set oRng = ActiveDocument.Range
  With oRng.Find
    .Text = "Research Refs"
    .Font.Bold = True
    While .Execute
      Set oRngE = oRng.Duplicate
      oRngE.End = ActiveDocument.Range.End
      With oRngE.Find
        .Text = "§"
        .Font.Bold = True
        If .Execute Then
          oRngE.Start = oRng.Start
          oRngE.Delete
        End If
      End With
      oRng.Collapse wdCollapseEnd
    Wend
  End With
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
Reply

Tags
word vba macro



Similar Threads
Thread Thread Starter Forum Replies Last Post
I am trying to delete text of any format between two bold, recurring keywords or symbols bold (or unbold) section of text instead of bold toggling Burt Word 6 04-06-2019 09:09 AM
I am trying to delete text of any format between two bold, recurring keywords or symbols Macro to delete text from cells with specific format Soenke Word VBA 4 09-01-2016 08:55 AM
Bold each line of text that starts with a recurring symbol qubie Word 6 08-26-2016 07:10 AM
I am trying to delete text of any format between two bold, recurring keywords or symbols Text in #1 is made bold, rest of the document is edited, text in #1 is now not bold footer-assistance Word 1 06-29-2015 03:49 AM
Format Bold in one line makes all lines bold Nitte Word 2 02-07-2013 12:34 AM

Other Forums: Access Forums

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