Previous Document Next Document

Object Model Reference : Classes : W : Windows : Properties : Windows.Item


Windows.Item

Property Item(Index As Long) As Window

Description

Member of Windows

The Item property returns a read-only reference to a window in a Windows collection.

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

Parameter
Description
Index
Specifies the window by its index number

VBA example

The following VBA 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 2013 Corel Corporation. All rights reserved.