View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] willjohnson33@yahoo.com is offline
external usenet poster
 
Posts: 15
Default Help with a quick way to close all duplicate windows using VBA please

I am trying to figure out a way to close all duplicate windows of
workbooks using VBA
I thought this would work but it doesn't.

For Each wb In Workbooks
If Windows.Count 1 Then
For i = 1 To Windows.Count
Windows(2).Close
Next i
End If
Next wb

For example: I have 3 workbooks wb1, wb2, wb3 and with wb3 I have 2
windows open so there are acutally 4 windows total. wb1, wb2, wb3:1,
wb3:2

I only want to close wb3:2. And would prefer to do it without having
to actually activate each workbook.

Any help is greatly appreciated.