Etudes for Microsoft Word Programmers. Appendix.


Information on this page is from Microsoft MSDN http://msdn.microsoft.com.

Object View (Word 2003)

Object View contains the view attributes (show all, field shading, table gridlines, and so on) for a window or pane.

Using the View Object

Use the View property to return the View object. The following example sets view options for the active window.

With ActiveDocument.ActiveWindow.View
    .ShowAll = True
    .TableGridlines = True
    .WrapToWindow = False
End With

Remarks

Use the Type property to change the view. The following example switches the active window to normal view.

ActiveDocument.ActiveWindow.View.Type = wdNormalView

Use the Percentage property to change the size of the text on-screen.
The following example enlarges the on-screen text to 120 percent.

ActiveDocument.ActiveWindow.View.Zoom.Percentage = 120

Use the SeekView property to view comments, endnotes, footnotes, or the document header or footer.
The following example displays the current footer in the active window in print layout view.

With ActiveDocument.ActiveWindow.View
    .Type = wdPrintView
    .SeekView = wdSeekCurrentPageFooter
End With

View Object Properties

View object properties are described in the following table.

Property

Type

Description

Application

Application object

Used without an object qualifier, this property returns an Application object that represents the Microsoft Word application. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Remarks
Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

Creator

32-bit integer

Returns a 32-bit integer that indicates the application in which the specified object was created. For example, if the object was created in Microsoft Word, this property returns the hexadecimal number 4D535744, which represents the string "MSWD." This value can also be represented by the constant wdCreatorCode. Read-only Long.
Remarks
The Creator property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

DisplayBackgrounds

Read/write Boolean

Returns or sets a Boolean that represents whether background colors and images are shown when a document is displayed in print layout view. Corresponds to the Background colors and images (Print view only) option located on the View tab of the Options dialog box.

DisplayPage­Boundaries

Read/write Boolean

True to display the top and bottom margins (white space) and the gray area (gray space) between pages in a document. False to hide from view the white and gray space so that the pages flow together as one long page. The default value is True.
Remarks
This feature is only available in the Print Layout view and only affects the gray space on the top and bottom of a page, not the left and right sides of a page. This setting affects the document in the in the specified window. When the document is saved, the state of this setting is saved with it.

DisplaySmartTags

Read/write Boolean

True for Microsoft Word to display an underline beneath smart tags in a document.
Remarks
Smart tags are marked in documents with a dashed underline. Setting the DisplaySmartTags property to False does not remove smart tags; it only turns off displaying the underline.

Draft

Read/write Boolean

True if all the text in a window is displayed in the same sans-serif font with minimal formatting to speed up display.

FieldShading

Read/write WdFieldShading

Returns or sets on-screen shading for form fields.

FullScreen

Read/write Boolean

True if the window is in full-screen view.

Magnifier

Read/write Boolean

True if the pointer is displayed as a magnifying glass in print preview, indicating that the user can click to zoom in on a particular area of the page or zoom out to see an entire page or spread of pages.
Remarks
This property generates an error if the view is not print preview.

MailMerge­DataView

Read/write Boolean

True if mail merge data is displayed instead of mail merge fields in the specified window.
Remarks
If the specified window isn't a main document, an error occurs.

Parent

parent object

Returns an object that represents the parent object of the specified object.

ReadingLayout

Read/write Boolean

Sets or returns a Boolean that represents whether a document is being viewed in reading layout view. True switches the document to reading layout view. False closes reading layout view.

ReadingLayout­ActualView

Read/write Boolean

Sets or returns a Boolean that represents whether pages displayed in reading layout view are displayed using the same layout as printed pages.
Remarks
In reading layout view, pages are not displayed with the full content contained in the literal printed pages, as you would see in normal view or in print layout view. Instead they are displayed in screens. When the ReadingLayoutActualView property is set to True, the document is displayed as it would appear when printed. On smaller monitors, this requires a zoom level that makes the document hard to read, but it is fine for larger monitors.

ReadingLayout­AllowMultiplePages

Read/write Boolean

Sets or returns a Boolean that represents whether reading layout view displays two pages side by side.
Remarks
Microsoft Word may or may not allow two pages to be displayed in reading layout view. If Word cannot maintain a reasonable aspect ratio, Word will display only one page. Therefore, if you set the ReadingLayoutAllowMultiplePages property to True and Word cannot display two pages, the property will remain set to False, and Word will display only a single page.

Reviewers

Reviewers object

Returns a Reviewers object that represents all reviewers.
Remarks
The Reviewers object is a global list of all reviewers, regardless of whether the reviewer reviewed the document displayed in the specified window.

RevisionsBalloon­ShowConnectingLines

Read/write Boolean

True for Microsoft Word to display connecting lines from the text to the revision and comment balloons.

RevisionsBalloon­Side

 

Sets or returns a WdRevisionsBalloonMargin constant that specifies whether Word displays revision balloons in the left or right margin in a document.

RevisionsBalloon­Width

Read/write

Single

Sets or returns a Single representing the global setting in Microsoft Word that specifies the width of the revision balloons.
Remarks
The width of revision balloons includes padding of one-half inch between the document margin and the edge of the balloon and one-eighth of an inch between the edge of the balloon and the edge of the paper. Microsoft Word adds space along the left or right edge of the paper. This width is extended into the margin and does not change the width of the document or paper size. Use the RevisionsBalloonWidthType property to specify the measurement to use when setting the RevisionsBalloonWidth property.

RevisionsBalloon­WidthType

Read/write WdRevisions BalloonWidthType

Sets or returns a WdRevisionsBalloonWidthType constant representing the global setting that specifies how Microsoft Word measures the width of revision balloons.
Remarks
The RevisionsBalloonWidthType property sets the measurement unit to use when setting the RevisionsBalloonWidth property.

RevisionsMode

Read/write WdRevisionsMode

Sets or returns a WdRevisionsMode constant representing the global option that specifies whether Microsoft Word displays balloons in the margin or inline with the document's text.

RevisionsView

Read/write WdRevisionsView

Sets or returns a WdRevisionsView constant representing the global option that specifies whether Word displays the original version of a document or a version with revisions and formatting changes applied.

SeekView

Read/write WdSeekView

Returns or sets the document element displayed in print layout view.
Remarks
This property generates an error if the view is not print layout view.

ShadeEditable­Ranges

Read/write Long

Returns or sets a Long that represents whether shading is applied to the ranges in a document for which users have permission to modify. True shades the ranges in a document that users can modify.
Remarks
Range shading is on by default. When range shading is on, or when you set the property to True, the ShadeEditableRanges property returns a value of 65535. When you set the ShadeEditableRanges property to False it returns a value of 0. The values have no meaning beyond indicating whether the property is True or False.

ShowAll

Read/write Boolean

True if all nonprinting characters (such as hidden text, tab marks, space marks, and paragraph marks) are displayed.

ShowAnimation

Read/write Boolean

True if text animation is displayed.

ShowBookmarks

Read/write Boolean

True if square brackets are displayed at the beginning and end of each bookmark.

ShowComments

Read/write Boolean

True for Microsoft Word to display the comments in a document.
Remarks
If revision marks are displayed in balloons in the right or left margin, comments are displayed in balloons. If revision marks are displayed inline, the text to which comments apply is surrounded by wide-angled square brackets; when a user places the mouse pointer over the text within the brackets, the related comment is displayed in a square balloon directly above the mouse pointer.

ShowDrawings

Read/write Boolean

True if objects created with the drawing tools are displayed in print layout view.

ShowHighlight

Read/write Boolean

True if highlight formatting is displayed and printed with a document.

ShowHyphens

Read/write Boolean

True if optional hyphens are displayed. An optional hyphen indicates where to break a word when it falls at the end of a line.

ShowInk­Annotations

Read/write Boolean

Returns or sets Boolean that shows or hides handwritten ink annotations. True displays ink annotations. False hides ink annotations.
Remarks
To work with ink annotations, you must be running Microsoft Word on a tablet computer. For more information on adding handwritten ink annotations to a document, see "Mark up a document with ink annotations" in Microsoft Word Help.

ShowInsertions­AndDeletions

Read/write Boolean

True for Microsoft Word to display insertions and deletions that were made to a document with Track Changes enabled.

ShowMainTextLayer

Read/write Boolean

True if the text in the specified document is visible when the header and footer areas are displayed. This property is equivalent to the Show/Hide Document Text button on the Header and Footer toolbar.

ShowObjectAnchors

Read/write Boolean

True if object anchors are displayed next to items that can be positioned in print layout view.

ShowOptionalBreaks

Read/write Boolean

True if Microsoft Word displays optional line breaks.

ShowParagraphs

Read/write Boolean

True if paragraph marks are displayed.

ShowPicture­PlaceHolders

Read/write Boolean

True if blank boxes are displayed as placeholders for pictures.

ShowRevisions­AndComments

Read/write Boolean

True for Microsoft Word to display revisions and comments that were made to a document with Track Changes enabled.

ShowSpaces

Read/write Boolean

True if space characters are displayed.

ShowTabs

Read/write Boolean

True if tab characters are displayed.

ShowText­Boundaries

Read/write Boolean

True if dotted lines are displayed around page margins, text columns, objects, and frames in print layout view.

ShowXMLMarkup

Read/write

Long

Returns a Long that represents whether XML tags are viewed in a document. True indicates that tags are visible. False indicates that tags are hidden. wdToggle allows you to switch between showing and hiding the XML markup.

SplitSpecial

Read/write WdSpecialPane

Returns or sets the active window pane.

TableGridlines

Read/write Boolean

True if table gridlines are displayed.

Type

Read/write WdViewType

Returns or sets the view type.
Remarks
The Type property returns wdMasterView for all documents where the current view is an outline or a master document. The current view will never return wdOutlineView unless explicitly set first in code.
To check whether the current document is an outline, use the Type property and the Subdocuments collection's Count property. If the Type property returns either wdOutlineView or wdMasterView and the Count property returns zero, the document is an outline. For example:

Sub VerifyOutlineView()
    With ActiveWindow.View
        If .Type = wdOutlineView Or wdMasterView Then
            If ActiveDocument.Subdocuments.Count = 0 Then

                .
..

            End If
        End If
    End With
End Sub

WrapToWindow

Read/write Boolean

True if lines wrap at the right edge of the document window rather than at the right margin or the right column boundary. Remarks
This property has no effect in print layout or Web layout view.

Zoom

Zoom object

Returns a Zoom object that represents the magnification for the specified view.

View Object Methods

View object methods are described in the following table.

Method

Description

CollapseOutline

(Range)

Collapses the text under the selection or the specified range by one heading level.
Note  If the document isn't in outline or master document view, an error occurs.
Range   Optional Range object. The range of paragraphs to be collapsed. If this argument is omitted, the entire selection is collapsed.

ExpandOutline

(Range)

Expands the text under the selection or the specified range by one heading level.
Note  If the document isn't in outline or master document view, an error occurs.
Range   Optional Range object. The range of paragraphs to be expanded. If this argument is omitted, the entire selection is expanded.

NextHeaderFooter

If the selection is in a header, this method moves to the next header within the current section (for example, from an odd header to an even header) or to the first header in the following section. If the selection is in a footer, this method moves to the next footer.
Note  If the selection is in the last header or footer in the last section of the document, or if it's not in a header or footer at all, an error occurs.

PreviousHeaderFooter

If the selection is in a header, this method moves to the previous header within the current section (for example, from an even header to an odd header) or to the last header in the previous section. If the selection is in a footer, this method moves to the previous footer.
Note  If the selection is in the first header or footer in the first section of the document, or if it's not in a header or footer at all, an error occurs.

ShowAllHeadings

Toggles between showing all text (headings and body text) and showing only headings.
Note  This method generates an error if the view isn't outline view or master document view.

ShowHeading

(Level)

Shows all headings up to the specified heading level and hides subordinate headings and body text.
Note  This method generates an error if the view isn't outline view or master document view.
Level   Required Long. The outline heading level (a number from 1 to 9).

 

Enumerations

Enumeration WdFieldShading

Constant

Value

wdFieldShadingAlways

1

wdFieldShadingNever

0

wdFieldShadingWhenSelected

2

Enumeration WdRevisionsBalloonMargin

Constant

Value

wdLeftMargin

0

wdRightMargin

1

Enumeration WdRevisionsBalloonWidthType

Constant

Value

Description

wdBalloonWidthPercent

0

Measured as a percentage of the width of the document.

wdBalloonWidthPoints

1

Measured in points.

Enumeration WdRevisionsMode

Constant

Value

Description

wdBalloonRevisions

0

Displays revisions in balloons in the left or right margin.

wdInLineRevisions

1

Displays revisions within the text using strikethrough for deletions and underlining for insertions. This is the default setting for prior versions of Word.

wdMixedRevisions

2

Not supported.

Enumeration WdRevisionsView

Constant

Value

Description

wdRevisionsViewFinal

0

Displays the document with formatting and content changes applied.

wdRevisionsViewOriginal

1

Displays the document before changes were made.

Enumeration WdSeekView

Constant

Value

wdSeekCurrentPageFooter

10

wdSeekCurrentPageHeader

9

wdSeekEndnotes

8

wdSeekEvenPagesFooter

6

wdSeekEvenPagesHeader

3

wdSeekFirstPageFooter

5

wdSeekFirstPageHeader

2

wdSeekFootnotes

7

wdSeekMainDocument

0

wdSeekPrimaryFooter

4

wdSeekPrimaryHeader

1

Enumeration WdViewType

Constant

Value

wdMasterView

5

wdNormalView

1

wdOutlineView

2

wdPrintPreview

4

wdPrintView

3

wdReadingView

7

wdWebView

6

 


Etudes for Microsoft Word Programmers. Appendix. Object View.


Unless otherwise noted, all materials on this site are
© 2000-2009 Evgeny Akhundzhanov, All Rights Reserved Worldwide
Microsoft is in no way affiliated with, nor offers endorsement of, this site.
www.transcriber.ru | E-mail the Author