I have a Word 2010 document with a lot of lists that were copied from another document. Unfortunately, when I copied the lists into my document they do not start at 1 anymore as they did in the orginial but are continuing from the previous lists leading up to chaos in my document.
I need my macro to run along all the numbered lists in my document and restarts each list at 1. I tried this with listformat.applylisttemplate but when calling my lists with "For Each li In ActiveDocument.Lists" I could not use the listformat function. See my code snippet below.
Set temp3 = wrdApp.ListGalleries(wdNumberGallery).ListTemplates(1).ListLevels(1)
With temp3
.StartAt = 1
End With
For Each li In ActiveDocument.Lists
li.Range.ListFormat.ApplyListTemplate ListTemplate:=temp3
Next
Obviously I would like something in the form of:
For Each li In ActiveDocument.Lists
li. => restart list count here
Next
Can anyone help? Thanks!
Addition: my current text looks like below and I'm trying to get the macro to restart each list with 1 in Word:
INPUT:
Sometext
3. TextA
4. TextB
5. TextC
6. TextD
Some other text
21. Text q
22. Text w
23. Text e
OUTPUT after macro:
1. TextA
2. TextB
3. TextC
4. TextD
Some other text
1. Text q
2. Text w
3. Text e
Hi I have created a macro here that does exactly what you want.
You need to make the numbered lists as a certain style first. This is to make sure that the macro changes only the lists you need to change.
https://sites.google.com/site/anvilsoup/word/fix-numbered-items
How it works
I've chosen to use a reasonable method of determining when to restart lists: If the previous paragraph isn't a list item, then this paragraph must be a new list!
This logic is what most people use when starting a new list. It's sensible and conventional.
NOTE: If you need to have an unnumbered paragraph nestled within a list, you should consider using line breaks (SHIFT-ENTER) instead of paragraph breaks. Using line breaks will also ensure that indenting is preserved. Don't do strange things like turn off numbering for that paragraph. Technically this text is part of the same numbered item so it should be in the same paragraph.