![]() |
|
|
|
#1
|
|||
|
|||
|
I have a little macro that adds an opening bracket to sub level numbering e.g a) becomes (a) or b. becomes (b) etc., but the issue I'm having is that it does not add an opening bracket for roman numerals ii, iii or iv but does add an opening bracket for i or v - what line of code can I add to include ii, iii, iv?
Add brackets to sub level definitions.docx Code:
Sub DPU_TestDefinitions()
Dim oRng As Range, Para As Paragraph
With ActiveDocument
Set oRng = ActiveDocument.Range
With oRng.Find
.ClearFormatting
.Forward = True
.Wrap = wdFindStop
.Format = True
.MatchWildcards = True
.text = "^13([A-Za-z0-9])\)"
'make sure lists with unopened brackets a) get opening bracket and insert tab
.Replacement.text = "^p(\1)"
.Execute Replace:=wdReplaceAll
.text = "^13([a-za-z0-9])\."
'make sure lists with period a. get brackets and insert tab
.Replacement.text = "^p(\1)"
.Execute Replace:=wdReplaceAll
End With
End With
End Sub
|
|
#2
|
||||
|
||||
|
Code:
Sub DPU_TestDefinitions()
Dim oRng As Range, Para As Paragraph
With ActiveDocument
Set oRng = ActiveDocument.Range
With oRng.Find
.ClearFormatting
.Forward = True
.Wrap = wdFindStop
.Format = True
.MatchWildcards = True
.text = "^13([A-Za-z0-9]{1,})\)"
'make sure lists with unopened brackets a) get opening bracket and insert tab
.Replacement.text = "^p(\1)"
.Execute Replace:=wdReplaceAll
'make sure lists with period a. get brackets and insert tab
.text = "^13([a-z0-9]{1,})."
.Execute Replace:=wdReplaceAll
End With
End With
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
|||
|
|||
|
Thank you so much Macropod, not seen you on here for a while so really appreciate your response.
|
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Multi level Caption numbering where second level starts a new number (not subset of previous number) | Cosmo | Word | 4 | 11-17-2023 08:49 PM |
| Multilevel numbering - Two styles for the same level? | TallTrees | Word | 9 | 07-29-2022 06:37 AM |
Multi-Level Clause Numbering - copy while retaining original numbering
|
TonySpeels | Word | 2 | 08-17-2016 11:18 AM |
Word numbering (multi level)
|
Matt_22 | Word | 1 | 04-07-2015 07:09 PM |
Heading level numbering in 2010 - wrong after second header level 1
|
taran | Word | 3 | 07-08-2013 01:12 PM |