The default behavior of the Word menu command is to tile windows horizontally with the windows stacked on top of each other.
Like all Word commands, however, you can modify the behavior of the menu item by creating a macro that overrides the default behavior. The following macro, when placed in a global template (the Normal template for most users) will tile all windows vertically, side-by-side, instead.
The macro first generates a new collection of all the visible windows. It then calculates the required window widths and heights. I've put in constants to force some space on the bottom (cnBOTTOMSPACE) and the right (cnRIGHTSPACE) in order to access the desktop. You can, of course, change the bottom and right space constants to suit. The collection is then cycled through, arranging the windows vertically.
Again, put the macro in a regular module of a global template (also known as an add-in). Or download an add-in containing the code.
'**************************************************************************
'Purpose: Modify Windows/Arrange All command to tile windows vertically
'Inputs: None. Change cnBOTTOMSPACE and cnRIGHTSPACE to suit
'Returns: None
'Results: Visible windows are tiled vertically, leaving cnBOTTOMSPACE pixels
' of desktop visible at the bottom, and cnRIGHTSPACE pixels of desktop
' visible on the right.
'Revisions: Rev 0 (JEM) (20030907) published in microsoft.public.mac.office.word newsgroup.
' Rev 1 (JEM) (20030908) added line to prevent error when all windows minimized.
' Rev 2 (JEM) (20040116) removed Windowstate command (N/A Macintosh).
'Tested: OS X: Word 2004, Word v.X; Classic: Word 2001, Word 98
'**************************************************************************
Public Sub WindowArrangeAll()
'By J.E. McGimpsey
'http://www.mcgimpsey.com/macoffice/word/verticalwindows.html
Const cnBOTTOMSPACE As Integer = 25
Const cnRIGHTSPACE As Integer = 50
Dim colVisibleWindows As New Collection
Dim wnMyWindow As Window
Dim i As Integer
Dim nWidth As Integer
Dim nHeight As Integer
For Each wnMyWindow In Windows
If wnMyWindow.WindowState <> wdWindowStateMinimize Then _
colVisibleWindows.Add wnMyWindow
Next wnMyWindow
With colVisibleWindows
If .Count <> 0 Then
nWidth = (Application.UsableWidth - cnRIGHTSPACE) / .Count
nHeight = Application.UsableHeight - cnBOTTOMSPACE
For i = 1 To .Count
With .Item(i)
.Width = nWidth
.Left = (i - 1) * nWidth - (i > 1)
.Top = 0
.Height = nHeight
End With
Next i
Else
System.Cursor = wdCursorNormal
End If
End With
End Sub
This page last updated on
© Copyright 2001 - 2004 McGimpsey and Associates. Except where noted, all code on this site may be distributed under the Gnu GPL. Acknowledgement is appreciated.