DEV Community

Oscar Sun(孫守真字任真)
Oscar Sun(孫守真字任真)

Posted on

Answer: Loop all words with VBA in MS Word

OK this is my implementation of Advanced Words

Sub Loop_all_words_with_VBA_in_MS_Word()
    Dim wds As VBA.Collection, wd As Range, d As Document
    Set d = ActiveDocument
    Set wds = Loop_all_words_with_VBA_in_MS_Word_GetWords(d)
    For Each wd In wds
        Rem do what you want
        
        Rem the four lines below are for checking it out only
        wd.Select

Top comments (0)