Previous Document Next Document
Views.Item

Property Item(IndexOrName As Variant) As View

Member of Views

The Item property returns a reference to a view in the collection.

The Item property is the default property, and its reference can be omitted when accessing items in the collection. For example, Views.Item(2) is the same as Views(2) — they both reference the second window in the Views collection.

The Item property returns a read-only value.

Parameters
Description
IndexOrName
Specifies the view by its index number or name:
Index — Acts as a preset placeholder for each object in the Views collection, uniquely identifying each member of the collection
Name — Represents the unique string value that identifies each view

The following code example displays the names of all of the views for the active document:

Sub Test() 
 Dim intCounter As Integer 
 Dim Vw As View 
 Dim s As String 
  For intCounter = 1 To ActiveDocument.Views.Count 
   Set Vw = ActiveDocument.Views(intCounter) 
   s = s & Vw.Name & vbCr 
  Next intCounter 
 MsgBox "The current document contains the following views: " & vbCr 
& s 
 Set Vw = Nothing 
End Sub 
Sub Test() 
 Dim Vw As View 
 Dim s As String 
  For Each Vw In ActiveDocument.Views 
   s = s & Vw.Name & vbCr 
  Next Vw 
 MsgBox "The current document contains the following views: " & vbCr 
& s 
 Set Vw = Nothing 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.