Object Model Reference : Classes : W : Workspaces : Properties : Workspaces.Item |
Property Item(IndexOrName As Variant) As Workspace
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.
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 |
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 |
Copyright 2013 Corel Corporation. All rights reserved.