ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Arrange Icons of Minimized Excel Windows (https://www.excelbanter.com/excel-programming/374411-arrange-icons-minimized-excel-windows.html)

Johnny Naperville

Arrange Icons of Minimized Excel Windows
 
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.

NickHK[_3_]

Arrange Icons of Minimized Excel Windows
 
You can't arrange windows that are minimized, using "Windows.Arrange". If
you want easy access to all the WBs, check the OptionsShown 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

"Johnny Naperville" ...
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.




Johnny Naperville

Arrange Icons of Minimized Excel Windows
 
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.



NickHK[_3_]

Arrange Icons of Minimized Excel Windows
 
Johnny,
Record a macro whilst you make that change.

NickHK

"Johnny Naperville" ...
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.





Johnny Naperville

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.

NickHK[_3_]

Arrange Icons of Minimized Excel Windows
 
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

"Johnny Naperville" ...
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.





All times are GMT +1. The time now is 10:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com