• For Each NEXT Loop not working

    From Khaqan Yusuf@21:1/5 to All on Fri Feb 12 14:40:47 2021
    Sub EditAllOpenWordDocuments()

    Dim openDoc As Document

    For Each openDoc In Documents

    'DO STUFF

    Next openDoc

    End Sub


    'NEXT just refuses to go to next open word document,,,WHY???

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Khaqan Yusuf@21:1/5 to Khaqan Yusuf on Fri Feb 12 20:36:58 2021
    On Saturday, February 13, 2021 at 1:40:47 AM UTC+3, Khaqan Yusuf wrote:
    Sub EditAllOpenWordDocuments()

    Dim openDoc As Document

    For Each openDoc In Documents

    'DO STUFF

    Next openDoc

    End Sub


    'NEXT just refuses to go to next open word document,,,WHY???



    Just solved it.......Seems to work fine after adding
    openDoc.Activate

    at start of DO STUFF area, then every open word document is activated in turn while DO STUFF runs on it, then it goes to next open file......Point being to keep all open files open before and after this For Each openDoc in Documents ...Loop.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)