Type Property Example
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
If the active window is a document, this example redefines the Heading 1 style as centered.
If ActiveDocument.ActiveWindow.Type = wdWindowDocument Then
ActiveDocument.Styles("Heading 1") _
.ParagraphFormat.Alignment = wdAlignParagraphCenter
End If
This example switches the active window to print preview. The Type property creates a new print preview window.
ActiveDocument.ActiveWindow.View.Type = wdPrintPreview
This example displays a message that indicates the style type of the style named "SubTitle" in the active document.
If ActiveDocument.Styles("SubTitle").Type = _
wdStyleTypeParagraph Then
MsgBox "Paragraph style"
ElseIf ActiveDocument.Styles("SubTitle").Type = _
wdStyleTypeCharacter Then
MsgBox "Character style"
End If
This example accepts the next revision in the active document if the revision type is inserted text.
Set myRev = Selection.NextRevision
If Not (myRev Is Nothing) Then
If myRev.Type = wdRevisionInsert Then myRev.Accept
End If
This example formats the selection as engraved if the selection isn't an insertion point.
If Selection.Type <> wdSelectionIP Then
Selection.Font.Engrave = True
Else
MsgBox "You need to select some text."
End If