Loop through the Documents : Documents « Word « VBA / Excel / Access / Word






Loop through the Documents

 
Sub forEach()
    Dim Doc As Document
    For Each Doc In Documents
        Doc.Close SaveChanges:=wdSaveChanges
    Next
End Sub

 








Related examples in the same category

1.Changes all bold formatting in the open document named Example.doc to italic formatting.
2.To maximize, minimize, or "restore" a window, set its WindowState property to wdWindowStateMaximize, wdWindowStateMinimize, or wdWindowStateNormal, respectively
3.Check the current document count