Approach 1 - Verify Version Status of Each Resource to get Checked Out Resources:
'First let us create an excel file to store the data
Set objExcel = CreateObject("Excel.Application")
Set objExcelFile = objExcel.Workbooks.Add
objExcelFile.SaveAs "Specified Excel Fie Path"
Set objSheet = objExcelFile.Worksheets.Item(1)
objSheet.Cells(1,1) = "Checked Out Resource"
objSheet.Cells(1,2) = "Checked Out By"
objSheet.Cells(1,3) = "Last Modified Date"
objSheet.Range("A1:C1").Interior.ColorIndex = 49
objSheet.Range("A1:C1").Font.ColorIndex = 2
objExcelFile.Save
'We have the excel file ready. Now let us get the required details and save them in excel
Set objQCConnection = QCUtil.QCConnection
Set objQCResourceFactory = objQCConnection.QCResourceFactory
Set objFilter = objQCResourceFactory.Filter
Set objQCResourceFactory = objQCConnection.QCResourceFactory
Set objFilter = objQCResourceFactory.Filter
Set objResources = objFilter.NewList
For Each Resource In objResources
If Resource.VersionData.IsCheckedOut Then
iRowCount = objSheet.UsedRange.Rows.Count
objSheet.Cells(iRowCount+1,1) = Resource.Name
objSheet.Cells(iRowCount+1,2) = Resource("RSC_VC_CHECKOUT_USER_NAME")
objSheet.Cells(iRowCount+1,3) = Resource("RSC_VTS")
End If
Next
Set objResources = Nothing
Set objFilter = Nothing
Set objQCResourceFactory = Nothing
Set objQCConnection = Nothing
Set objQCResourceFactory = Nothing
Set objQCConnection = Nothing
'Save and Close the excel with some formatting
objSheet.Range("A1:C"&iRowCount+1).HorizontalAlignment = -4108
objSheet.Range("A1:C"&iRowCount+1).VerticalAlignment = -4108
objSheet.Cells.Font.Name = "Trebuchet MS"
objSheet.Cells.Font.Size = 10
objSheet.Columns.AutoFit
objSheet.Range("A1:C"&iRowCount+1).Borders.LineStyle = 1
objExcelFile.Save
objExcelFile.Close
Set objSheet = Nothing
Set objExcelFile = Nothing
Set objExcel = Nothing
Approach 2 - Filter with Checked_Out Status to get all Checked Out Resources:
'First let us create an excel file to store the data
Set objExcel = CreateObject("Excel.Application")
Set objExcelFile = objExcel.Workbooks.Add
objExcelFile.SaveAs "Specified Excel Fie Path"
Set objSheet = objExcelFile.Worksheets.Item(1)
objSheet.Cells(1,1) = "Checked Out Resource"
objSheet.Cells(1,2) = "Checked Out By"
objSheet.Cells(1,3) = "Last Modified Date"
objSheet.Range("A1:C1").Interior.ColorIndex = 49
objSheet.Range("A1:C1").Font.ColorIndex = 2
objExcelFile.Save
'We have the excel file ready. Now let us get the required details and save them in excel
Set objQCConnection = QCUtil.QCConnection
Set objQCResourceFactory = objQCConnection.QCResourceFactory
Set objFilter = objQCResourceFactory.Filter
objFilter.Filter("RSC_VC_STATUS") = "Checked_Out"
Set objCheckedOutResources = objFilter.NewList
For Each Resource In objCheckedOutResources
iRowCount = objSheet.UsedRange.Rows.Count
objSheet.Cells(iRowCount+1,1) = Resource.Name
objSheet.Cells(iRowCount+1,2) = Resource("RSC_VC_CHECKOUT_USER_NAME")
objSheet.Cells(iRowCount+1,3) = Resource("RSC_VTS")
Next
Set objResources = Nothing
Set objFilter = Nothing
Set objQCResourceFactory = Nothing
Set objQCConnection = Nothing
'Save and Close the excel with some formatting
objSheet.Range("A1:C"&iRowCount+1).HorizontalAlignment = -4108
objSheet.Range("A1:C"&iRowCount+1).VerticalAlignment = -4108
objSheet.Cells.Font.Name = "Trebuchet MS"
objSheet.Cells.Font.Size = 10
objSheet.Columns.AutoFit
objSheet.Range("A1:C"&iRowCount+1).Borders.LineStyle = 1
objExcelFile.Save
objExcelFile.Close
Set objSheet = Nothing
Set objExcelFile = Nothing
Set objExcel = Nothing