Closing all Windows

I’m trying to set up a window that when opened will close all other windows. I’m trying to avoid just typing every window name, is there a way to select all the windows to close them?

Use the window function with window count.

I modified the following example from the LR

For i As Integer = 0 To WindowCount - 1 Dim w As Window = Window(i) If w <> Nil Then w.close End If Next


For i As Integer = WindowCount - 1 downto 0 if Window(i) <> nil then Window(i).close Next