I have over 100 instances of MS Word's numbered lists (A, B, C, D, E) scattered throughout a file. I have written VBA code that converts this to straight text and inserts the appropriate letter and a tab (e.g., A + tab) at the beginning of each line. However, I have to manually select each list. What VBA code will automatically select each list and execute the code that converts it?

Here is my VBA code that converts a selected list. By the way, every list is A, B, C, D, E.

Your code does count the number of instances of numbered lists. But it does not move to the next numbered list. Because of that, I'm not sure that counting the number of numbered lists is useful. Perhaps the loop can simply execute (with a Find command in the code) until it's at the end of the file. So, I think the key, now is figuring out what the Find command should look like.

My Word document has several 5-item lists. I want to replace the first item with "A [tab] the original text", the second item with "B [tab] the original text", etc. The code is supposed to loop through the document 5 times. The first time through, it revises the 5th item on the list, the second time through, it revises the 4th item on the list, etc.

The following line of code is supposed to go back to the top of the document when the bottom of the document is reached.
Selection.HomeKey unit:=wdStory
It works the very first time. That is, if I am in the middle of the document when the macro starts, then it goes to the top of the document. For some reason, it doesn't go back to the top of the file again. Why not?

Here is the complete code:

Dim strActualLetter As String Dim strTargetLetter As String Dim intOptionNumber As Integer Dim fEOD As Boolean Dim intParagraphNumber As Integer 'Go to the top of the file, go through every paragraph, and remove formatting for Option E. 'The second time through, remove formatting for Option D, etc. For intOptionNumber = 5 To 1 Step -1 ActiveDocument.Range.MoveStart Selection.HomeKey unit:=wdStory 'Go to the top of the document. This works only the first time through. strTargetLetter = Mid("ABCDE", intOptionNumber, 1) fEOF = False intParagraphNumber = 1 MsgBox "strTargetLetter = " & strTargetLetter Do Until fEOD If Selection.Range.ListFormat.ListType > 0 Then strActualLetter = Mid("ABCDE", Selection.Range.ListFormat.ListValue, 1) If strActualLetter = strTargetLetter Then Selection.Range.ListFormat.RemoveNumbers NumberType:=wdNumberParagraph Selection.TypeText Text:=strActualLetter & vbTab End If End If Selection.MoveDown unit:=wdParagraph, Count:=1 intParagraphNumber = intParagraphNumber + 1 If Selection.Bookmarks.Exists("\EndOfDoc") = True Then fEOD = True End If Loop Next

Excellent. I tried it on numbers, a b c d, and A B C D. It worked on all of them. For standard bullets, it works too; it changed the bullets to an undisplayed character (on my computer, it appears as a question mark with a box around it).