Switching windows

F

Francis Hookham

Is there a key combination for switching from one Word window to another?

I want to write a macro which will "Arrange All" windows (two will do) and
then reduce the width of both so than so desktop is visible - easy to do by
recording actions but the second window is then know by it's actual name
which will not work later when different windows are open at a later date

Alternatively is there a way of the macro knowing the names of the open
files?

Francis Hookham
 
E

Elliott Roper

Francis Hookham said:
Is there a key combination for switching from one Word window to another?

I want to write a macro which will "Arrange All" windows (two will do) and
then reduce the width of both so than so desktop is visible - easy to do by
recording actions but the second window is then know by it's actual name
which will not work later when different windows are open at a later date

I have a partial answer and a further question.

In OS X "cmd - ~" will cycle through all the windows of the current
application, including Word.

How do you make 'Window -> Arrange All' arrange two document windows
side by side instead of one above the other and occupying the entire
width of the screen?
 
D

Dayo Mitchell

How do you make 'Window -> Arrange All' arrange two document windows
side by side instead of one above the other and occupying the entire
width of the screen?

Actually, this is something I spend lots of time doing manually, and would
also love to know the answer to. If not already possible, perhaps it is
worth a feedback request for a Prefs checkbox to "arrange all" vertically?

A next window command as consistent as cmd-q and cmd-w would also be a nice
feature....

Dayo
 
E

Elliott Roper

Dayo Mitchell said:
Actually, this is something I spend lots of time doing manually, and would
also love to know the answer to. If not already possible, perhaps it is
worth a feedback request for a Prefs checkbox to "arrange all" vertically?

A good idea. I'll slap in a feedback request too. I did want to be sure
there was not already one there before making a bigger fool of myself.

(right. that's sorted, and I wasn't a tiny bit sarcastic)
A next window command as consistent as cmd-q and cmd-w would also be a nice
feature....

Have you ever seen a situation where cmd-~ does NOT work? It is
consistent enough for me. My feeling is that the OS does it before the
application gets a chance to do it inconsistently.
For bonus points, after setting your system prefs up appropriately,
ctrl-w cycles through every open window in every application. (OS X)
 
J

James Porter

Here's an addendum: command+shift+~ 2 cycle in reverse order.

WOrd has hotkeys for this (F6+Command + shift), listed in its help menus

JIP
 
D

Dayo Mitchell

Have you ever seen a situation where cmd-~ does NOT work? It is
consistent enough for me. My feeling is that the OS does it before the
application gets a chance to do it inconsistently.
For bonus points, after setting your system prefs up appropriately,
ctrl-w cycles through every open window in every application. (OS X)

I got all excited, but cmd-~ doesn't work in excel or word for me (very
possibly b/c I didn't like it and redefined it a while back), although it
does in entourage and explorer, which is a nice trick to learn. Thanks very
much! I will have to go un-redefine my word.

Not in X yet, not planning to go anytime soon, happily obsolete...

Dayo
 
J

J.E. McGimpsey

Elliott Roper said:
How do you make 'Window -> Arrange All' arrange two document windows
side by side instead of one above the other and occupying the entire
width of the screen?

one way:

Put this in a global template:

Public Sub WindowArrangeAll()
'J.E. McGimpsey
Const BOTTOMSPACE As Integer = 25
Const RIGHTSPACE As Integer = 50
Dim cVisibleWindows As New Collection
Dim oWindow As Window
Dim i As Integer
Dim iWidth As Integer
Dim iHeight As Integer

For Each oWindow In Windows
If oWindow.WindowState <> wdWindowStateMinimize Then _
cVisibleWindows.Add oWindow
Next oWindow
With cVisibleWindows
iWidth = (Application.UsableWidth - RIGHTSPACE) / .Count
iHeight = Application.UsableHeight - BOTTOMSPACE
For i = 1 To .Count
With .Item(i)
.Activate
.WindowState = wdWindowStateNormal
.Width = iWidth
.Left = (i - 1) * iWidth - (i > 1)
.Top = 0
.Height = iHeight
End With
Next i
End With
End Sub

Adjust BOTTOMSPACE and RIGHTSPACE to make more or less of the
desktop visible.
 
E

Elliott Roper

J.E. McGimpsey said:
one way:

Put this in a global template:

Public Sub WindowArrangeAll()
'J.E. McGimpsey
Const BOTTOMSPACE As Integer = 25
Const RIGHTSPACE As Integer = 50
Dim cVisibleWindows As New Collection
Dim oWindow As Window
Dim i As Integer
Dim iWidth As Integer
Dim iHeight As Integer

For Each oWindow In Windows
If oWindow.WindowState <> wdWindowStateMinimize Then _
cVisibleWindows.Add oWindow
Next oWindow
With cVisibleWindows
iWidth = (Application.UsableWidth - RIGHTSPACE) / .Count
iHeight = Application.UsableHeight - BOTTOMSPACE
For i = 1 To .Count
With .Item(i)
.Activate
.WindowState = wdWindowStateNormal
.Width = iWidth
.Left = (i - 1) * iWidth - (i > 1)
.Top = 0
.Height = iHeight
End With
Next i
End With
End Sub

Adjust BOTTOMSPACE and RIGHTSPACE to make more or less of the
desktop visible.

McGimpsey you are a star! Works like a bought one!

Where does .Count come from? Can I assume it is an automatic property
of cVisibleWindows set up by the For Each oWindow In Windows loop?

and what's the i>1 in .Left = (i - 1) * iWidth - (i > 1)?
Is that just a cunning plan to put 1 pixel gap after all but the first?
i.e TRUE==1 and FALSE==0 No. That can't be right, that would make them
overlap by 1 pixel. Puzzled I am.
 
E

Elliott Roper

J.E. McGimpsey said:
Yes, .Count is the only property of a Collection Object.


You're probably puzzled because in XL, TRUE evaluates to 1 and False
to 0. With VBA, as in most other languages, TRUE evaluates to -1, so
subtracting the (i>1) nudges subsequent windows to the right one
pixel, as you surmised.

Aha! Yep, I'm used to testing the low bit for TRUE/FALSE. Thanks again
J.E. It was a useful, sneaky and illuminating piece of code.
 

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