View Single Post
 
Old 02-15-2024, 03:16 AM
gmaxey gmaxey is offline Windows 10 Office 2019
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

Your sample document contains of unrelated lists e.g., A) and 1) are not related. 1) is not the second level of A). So if you stick with that arrangement, you will need something like:

Code:
Sub ClearNumberedList()
Dim para As Paragraph
  For Each para In ActiveDocument.Paragraphs
    If para.Range.ListFormat.ListType = wdListSimpleNumbering Then
      If IsNumeric(Left(para.Range.ListFormat.ListString, 1)) And Right(para.Range.ListFormat.ListString, 1) = ")" Then
        para.Range.Delete
      End If
    End If
  Next para
End Sub

If you used related lists, it would be as simple as:


Code:
Sub ScratchMacro()
'A basic Word Macro coded by Gregory K. Maxey
Dim oPar As Paragraph
  For Each oPar In ActiveDocument.Range.Paragraphs
    If oPar.Range.ListFormat.ListLevelNumber = 2 Then
      oPar.Range.Delete
    End If
  Next
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote