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