Class Windows (Excel VBA)
A collection of all the Window objects in Microsoft Excel. To use a Windows class variable it first needs to be instantiated, for example
Dim wnds as Windows
Set wnds = ActiveWindow.Selection
For Each
Here is an example of processing the Windows items in a collection.
Dim wnd As Window
For Each wnd In Windows
Next wnd
Arrange
Arranges the windows on the screen.
Arrange (ArrangeStyle, ActiveWorkbook, SyncHorizontal, SyncVertical)
Application.Windows.Arrange ArrangeStyle:=xlArrangeStyleTiled
Arguments
Optional arguments
The following arguments are optional
ArrangeStyle (XlArrangeStyle) - One of the constants of XlArrangeStyle specifying how the windows are arranged.
Possible values are
xlArrangeStyleCascade | Windows are cascaded. |
xlArrangeStyleHorizontal | Windows are arranged horizontally. |
xlArrangeStyleTiled | Default. Windows are tiled. |
xlArrangeStyleVertical | Windows are arranged vertically. |
ActiveWorkbook (Boolean) - True to arrange only the visible windows of the active workbook. False to arrange all windows. The default value is False.
SyncHorizontal (Boolean) - Ignored if ActiveWorkbook is False or omitted. True to synchronize the windows of the active workbook when scrolling horizontally. False to not synchronize the windows. The default value is False.
SyncVertical (Boolean) - Ignored if ActiveWorkbook is False or omitted. True to synchronize the windows of the active workbook when scrolling vertically. False to not synchronize the windows. The default value is False.
BreakSideBySide
Ends side-by-side mode if two windows are in side-by-side mode. Returns a Boolean value that represents whether the method was successful.
Dim booBreakSideBySide As Boolean
booBreakSideBySide = ActiveWindow.Selection.BreakSideBySide
CompareSideBySideWith
Opens two windows in side-by-side mode. Returns a Boolean value.
You cannot use the CompareSideBySideWith method with the Application object or the ActiveWorkbook property.
CompareSideBySideWith (WindowName)
WindowName: The name of the window.
Dim booCompareSideBySideWith As Boolean
booCompareSideBySideWith = ActiveWindow.Selection.CompareSideBySideWith(WindowName:=)
Count
Returns a Long value that represents the number of objects in the collection.
Dim lngCount As Long
lngCount = ActiveWindow.Selection.Count
Item
Returns a single Window object from the collection.
Item (Index)
Index: The name or index number of the object.
Dim wndItem As Window
Set wndItem = ActiveWindow.Selection(Index:=1)
ResetPositionsSideBySide
Resets the position of two worksheet windows that are being compared side by side.
Use the ResetPositionsSideBySide method to reset the position of two worksheets that are being compared side by side. For example, if a user minimizes or maximizes one of the two worksheet windows being compared, the ResetPositionsSideBySide method resets the display so that the two windows are displayed side by side again.
ActiveWindow.Selection.ResetPositionsSideBySide
SyncScrollingSideBySide
True enables scrolling the contents of windows at the same time when documents are being compared side by side. False disables scrolling the windows at the same time.
ActiveWindow.Selection.SyncScrollingSideBySide = True