View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Johnny Naperville Johnny Naperville is offline
external usenet poster
 
Posts: 5
Default Arrange Icons of Minimized Excel Windows

An excellent suggestion! I found that you can arrange the icons given some
caveats.

'Line 1: Open a workbook
Workbooks.Open Filename:="C:\Work\MyWorkbook.xls"
'Line 2: Minimize it
wb.Windows(1).WindowState = xlMinimized
'Line 3: Activate a window that I know is already open and minimized
Windows("CommonCode.xls").Activate
'Line 4: Arrange the icons
Windows.Arrange ArrangeStyle:=5
'Line 5: Put the focus on an open window
Windows("AnotherWorkbook.xls").Activate

The code on Line 4 will compile regardless. However, execution will halt
with a run-time error unless the focus is on a minimized window.