Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 07-30-2019, 10:32 AM
gmaxey gmaxey is offline Macro to apply a style between quotations Windows 10 Macro to apply a style between quotations Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,635
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

You might try:

Code:
Sub Demo()
Dim oRng As Range
Dim oRngDup As Range
  Set oRng = ActiveDocument.Range
    With oRng.Find
      .ClearFormatting
      .Style = ActiveDocument.Styles("Heading 2")
      Do While .Execute
        Set oRngDup = oRng.Duplicate
        oRngDup.Collapse wdCollapseStart
        oRngDup.MoveEndUntil ".", wdForward
        oRngDup.End = oRngDup.End + 1
        oRngDup.Style = ActiveDocument.Styles("Strong")
        oRng.Collapse wdCollapseEnd
        If oRng.End + 1 = ActiveDocument.Range.End Then Exit Do
      Loop
   End With
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
My style keeps changing, can't get saved style to apply Meenie50 Word 7 07-20-2017 03:47 PM
Macro to apply a style between quotations Apply Heading Style When Combining Documents snot369 Word 1 01-13-2017 11:04 AM
Is it possible to have a style apply two formats based upon text? DMcCollum Word 3 05-02-2015 06:29 PM
Macro to apply a style between quotations Can I apply a style to an image? humbleosity Word 1 01-14-2014 09:38 AM
Macro to apply a style between quotations Macro to apply style to selected tables ubns Word 1 08-02-2012 04:09 AM

Other Forums: Access Forums

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