Previous Document Next Document

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


Workspaces.Item

Property Item(IndexOrName As Variant) As Workspace

Description

Member of Workspaces

The Item property returns a read-only reference to a workspace in the Workspaces collection. It is the default property of the WorkSpaces class.

Parameter
Description
IndexOrName
Specifies the workspace by its index number or name:
 
Index — Specifies the preset placeholder that uniquely identifies each member of the Workspaces collection
 
Name — Specifies the string that uniquely identifies each workspace

VBA example 1

The following VBA example displays a message box that lists the names of the workspaces.

Sub Test()
 Dim intCounter As Integer
 Dim Ws As Workspace
 Dim s As String
 For intCounter = 1 To Workspaces.Count
  Set Ws = Workspaces(intCounter)
  s = s & Ws.Name & vbCr
 Next intCounter
 MsgBox "The current document contains the following workspaces: " & vbCr & s
 Set Ws = Nothing
End Sub
VBA example 2

The following VBA example performs the same procedure as the previous example. However, instead of using a For Next command, it uses the For Each command in Visual Basic to iterate through all workspaces in the collection.

Sub Test()
 Dim Ws As Workspace
 Dim s As String
  For Each Ws In Workspaces
   s = s & Ws.Name & vbCr
  Next Ws
 MsgBox "The current document contains the following workspaces: " & vbCr & s
 Set Ws = Nothing
End Sub

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.