' Connect to the top-level ClearCase application object
Dim CC As New ClearCase.Application
' Create a query object for getting checked-out files
Dim COQuery As CCCheckedOutFileQuery
Set COQuery = CC.CreateCheckedOutFileQuery
' Set up the array of paths to use
COQuery.PathArray = Array("m:\carol_main\caroltest", _
"m:\carol_main\stage", "m:\carol_main\policy")
' Restrict the collection to files checked out by user "bill"
COQuery.User = "bill"
' Include in the collection all files checked out in the VOBs
' specified in the path array
COQuery.PathSelects = ccSelection_AllInVOB
' Apply the query, getting a CCCheckedOutFiles collection
Dim CheckedOutFiles As CCCheckedOutFiles
Set CheckedOutFiles = COQuery.Apply
Dim strMsg As String
Dim strView As String
strMsg = CheckedOutFiles.Count & " files are checked out: "
' Gather info about the checked-out files for display
Dim I As Long
For I = 1 To CheckedOutFiles.Count
Dim COFile As CCCheckedOutFile
Set COFile = CheckedOutFiles(I)
On Error Resume Next
' Get the view to which the file is checked out
strView = COFile.ByView
If Err.Number <> 0 Then
strView = "<could not get view>"
End If
' Get the branch on which the file is checked out
strMsg = strMsg & vbCrLf & COFile.Path & _
" branch " & COFile.Branch & " to view " & strView
Next
' Display the result
MsgBox strMsg