Fix VBA Word Code

Job ID: 32783015

Budget: $10 – $30 USD

A small paragraph is better than a copy paste... read this, is just 1 min before bidding:

I have this small macro, it basically cycles through all the numbered lists in a word document (which I attach) and stitches all the lists into a single one. I want to add to the macro that it keeps stitching everything EXCEPT if the numberformat of the list is "SECTION".

This is the code and in *** is what I think is the answer but seems that my syntax is wrong (im open to other solutions ofc)

Sub MakeAllAutoNumbersSameList()
Dim i As Integer
Set myDoc = ActiveDocument
For i = 1 To myDoc.Paragraphs.Count
Set myRange = myDoc.Paragraphs(i).Range

If myRange.ListFormat.ListType <> wdListNoNumbering Then
***** HERE inside the IF Add: AND myRange.ListFormat.NumberFormat <> "SECTION %1."

myRange.ListFormat.RemoveNumbers
myRange.ListFormat.ApplyListTemplate _
ListTemplate:=ListGalleries(2).ListTemplates(1), _
ContinuePreviousList:=True
End If
Next i
ActiveDocument.Lists(1).Range.ListFormat.ListOutdent 'elimina la identacion
ActiveDocument.Lists(1).Range.ListFormat.ListOutdent
End Sub
Related categories: Visual Basic Word Visual Basic for Apps