Minimizing windows for 50+ opened books at one go

  • Thread starter Thread starter Max
  • Start date Start date
M

Max

Hi guys,

I've opened Book1.xls (I'm in Sheet1's A1, say), and then I open another 50
or so other books from a single folder (at one go). What I'm after is a
generic sub which can minimize all other windows (i.e. those from the 50+
other books except the ones for Book1.xls). I will trigger the sub from
Book1.xls.

Appreciate any insights. Thanks.

---
 
Max,

Private Sub CommandButton1_Click()
Dim Wnd As Window

'Quick way to handle Personal.xls and other hidden windows
On Error Resume Next
For Each Wnd In Application.Windows
If Wnd.Caption <> ActiveWindow.Caption Then
Wnd.WindowState = xlMinimized
End If
Next

End Sub

NickHK
 
Many thanks, Nick !
Runs smooth, but a small tweak requested as the sub also
minimizes my other windows (window2, 3, etc) opened in Book1.xls
I need these other windows to remain as-is.
 
Max,
Change
If Wnd.Caption <> ActiveWindow.Caption Then
To
If Wnd.Parent.Name <> ThisWorkbook.Name Then

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top