Previous Document Next Document
Windows.Item

Property Item(Index As Long) As Window

Member of Windows

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

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

The Item property returns a read-only value.

Parameters
Description
Index
Specifies a window by its index number

The following code example displays the caption of each window in the Windows collection:

Sub Test() 
 Dim intCounter As Integer 
 Dim Wnd As Window 
 Dim s As String 
  For intCounter = 1 To ActiveDocument.Windows.Count 
   Set Wnd = ActiveDocument.Windows(intCounter) 
   s = s & Wnd.Caption & vbCr 
  Next intCounter 
 MsgBox "The current document contains the following windows: " & 
vbCr & s 
 Set Wnd = Nothing 
End Sub 
Sub Test() 
 Dim Wnd As Window 
 Dim s As String 
  For Each Wnd In ActiveDocument.Windows 
   s = s & Wnd.Caption & vbCr 
  Next Wnd 
 MsgBox "The current document contains the following windows: " & 
vbCr & s 
 Set Wnd = Nothing 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.