Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-27-2018, 11:37 PM
gmayor's Avatar
gmayor gmayor is offline A few macros or functions run in a single macro? Windows 10 A few macros or functions run in a single macro? Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Based on your example the following should work


Code:
Sub Macro1()
'Graham Mayor - http://www.gmayor.com - Last updated - 28 Oct 2018
Dim orng As Range
    Set orng = ActiveDocument.Range
    orng.Font.Bold = True
    orng = Replace(orng, Chr(11), Chr(13))
    orng = Replace(orng, Chr(13) & Chr(13), Chr(13))
    With orng.Find
        Do While .Execute(FindText:="[0-9]{1,}-", MatchWildcards:=True)
            If orng.Start = orng.Paragraphs(1).Range.Start Then
                orng.MoveEndUntil ")"
                orng.End = orng.End - 2
                orng.Select
                orng = Replace(orng, Chr(13), Chr(32))
                orng = Replace(orng, Chr(32 & Chr(32)), Chr(32))
            End If
            orng.Collapse 0
        Loop
    End With
    Set orng = ActiveDocument.Range
    With orng.Find
        Do While .Execute(FindText:="A)", MatchWildcards:=False)
            If orng.Start = orng.Paragraphs(1).Range.Start Then
                orng.MoveEnd wdParagraph, 2
                orng.End = orng.End - 1
                orng = Replace(orng, Chr(13), Chr(32))
                orng = Replace(orng, Chr(32 & Chr(32)), Chr(32))
                orng.Font.Bold = False
            End If
            orng.Collapse 0
        Loop
    End With
lbl_Exit:
    Set orng = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
Reply

Tags
macro multiple functions



Similar Threads
Thread Thread Starter Forum Replies Last Post
A few macros or functions run in a single macro? Infinite loops occurring in find and replace functions in word macro Thefirstfish` Word VBA 5 04-06-2017 07:18 PM
A few macros or functions run in a single macro? Why are my Macros combined into a single module? Cyberseeker Excel Programming 1 04-02-2017 02:43 AM
A few macros or functions run in a single macro? Creating a "super macro" with all kind of functions Xanthopteryx PowerPoint 1 06-16-2016 01:38 AM
A few macros or functions run in a single macro? what functions would this task use, format, macro ? etc fremoy Word 2 02-16-2015 10:48 AM
A few macros or functions run in a single macro? Macro to save to a single PDF LukeExcelKid Excel Programming 4 11-17-2013 01:39 PM

Other Forums: Access Forums

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