Windows

Application.ActiveWindow.Type = wdWindowType.wdWindowDocument 

Windows("Temp.doc").Activate 
Windows(2).Activate

ActiveWindow.Caption 
ActiveWindow.DisplayRulers
ActiveWindow.DisplayScreenTips
ActiveWindow.DisplayVerticalRuler
ActiveWindow.DisplayVerticalScrollBar
ActiveWindow.DocumentMap
ActiveWindow.Split = True / False
ActiveWindow.PrintOut
ActiveWindow.WindowNumber

ActiveWindow.PageFit = wdPageFit.wdPageFotNone 

ActiveWindow.WindowState = wdWindowState.wdWindowStateNormal 

An error will occur if this is applied to an inactive window.


Multiple Windows

It is also possible to create multiple windows of the same document.
The Document object has a Window property that returns the collection of all the window objects associated with that given document.

objWindow.Activate 

If (Windows(1).Active = True) Then 
'this window is currently active
End If

Dim objDocument As Document 
objDocument = ActiveWindow.Document

Creating new Windows


Windows.Add(Window) 

The window object is the window you want to duplicate
If the Window object is missing then a new window of the active document is created.


This is the number of open windows.

Windows.Count 

When there are multiple windows open for a document the window caption is appended with a colon and a number.

Application.NewWindow 
objWindow.NewWindow
ActiveWindow.NewWindow

Arranging Windows


Windows.Arrange(wdArrangeStyle.wdIcons) 

Application.WindowState = wdWindowState.wdWindowStateMaximize 

Understanding the difference between Selecting and Activating

To make a different document the active document you can use the Activate method of the Document object.

Documents("document.doc").Activate 

Navigating

Scrolls the number of lines, the default is 1 line

ActiveWindow.SmallScroll 

Scrolls the number of screens, the default is 1 screen

ActiveWindow.LargeScroll 
ActiveWindow.ActivePane.LargeScroll Down:=
                                    Up:=
                                    ToRight:=
                                    ToLeft:=

Scrolls the numbe of document pages, default is 1 page down
This does not affect the position of the insertion point.
This is only available in Print Layout or Online View

ActiveWindow.PageScroll Down:= 
                        Up:=

This returns or sets the scroll bar position as a percentage of the document width

ActiveWindow.HorizontalPercentScrolled 
ActiveWindow.HorizontalPercentScrolled = 50
ActiveWindow.VerticalPercentScrolled

Closing Windows

This closes the active window of the active document and saves it.

ActiveDocument.ActiveWindow.Close SaveChanges:=wdSaveOptions.wdSaveChanges, _ 
                                  RouteDocument:=False


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext