Arrange Icons of Minimized Excel Windows

G

Guest

When I open one workbook in Microsoft Excel 2003 SP 2, the macro code in the
spreadsheet includes a reference to a second workbook which opens the second
workbook. When the second workbook loads, it minimizes itself. Then, I click
a button in a worksheet of the first workbook to load a third workbook, which
minimizes itself. However, the icons for the third workbook disappears behind
that for the second workbook. I can remedy this situation if I right-click on
one of the minimized workbooks and choose Arrange Icons from the
context-sensitive menu that pops up. I would like to put a command into my
program to arrange the icons immediately after the third workbook loads and
minimizes itself. I see the Windows.Arrange method, but it applies to the
open windows, not to the icons. My search of Help shows me many ways to
arrange the icons on my Windows desktop, but not within Excel. What do I need
to do? Thank you.
 
N

NickHK

You can't arrange windows that are minimized, using "Windows.Arrange". If
you want easy access to all the WBs, check the Options>Shown In Taskbar,
then the Window State of a window does not matter.
Or do not minimize the window, set .WindowState = xlNormal instead, then you
can arrange them.

NickHK
 
G

Guest

Show in Taskbar is selected in Tools | Options | View.

I would just like to know how to do programmatically what I can do manually,
if possible.

Thank you.
 
G

Guest

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.
 
N

NickHK

Johnny,
I can't check that at the moment, but it is normally a good idea to check
the .WindowState before you try to change a window's property
Recording a macro of any action you wish to perform (but are unsure the
syntax) is always a good starting point.

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

Top