Hi All,
Im trying to write macro to retrieve data from QC and Populate in excel sheet. i have a macro for selecting but please help me in populating in excel.
Private Sub Worksheet_Activate()
Me.Unprotect
Me.Cells.ClearContents
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
Dim MyArray()
MyArray = Array("Test_ID", "Test_Name", "Global")
With ws.Range(ws.[a1], ws.[c1])
.Value = MyArray
.HorizontalAlignment = xlCenter
.Font.Italic = True
.Font.Bold = True
.EntireColumn.ColumnWidth = 15
End With
'Me.Protect
End Sub
Sub Update_Tests_Fields()
Dim td As New TDConnection
Dim com As TDAPIOLELib.Command
Dim RecSet As TDAPIOLELib.Recordset
Dim rng As Range
'Set rng = Sheets("Sheet1").Range("A1:A10")
td.InitConnectionEx "url://qcbin"
Application.StatusBar = "Connecting to Quality Center.. Wait..."
td.Login "username", "passwd"
td.Connect "Prjt", "Domain"
Application.StatusBar = "........QC Connection is done Successfully"
Set com = td.Command
'For Each t In rng
com.CommandText = "Select TEST.TS_TEST_ID as Test_Id,TEST.TS_NAME as Test_Name,TEST.TS_USER_03 as Country from TEST where TEST.TS_SUBJECT in (SELECT AL_ITEM_ID from ALL_LISTS Where AL_ABSOLUTE_PATH like 'AAAAAGAAC%')"
Set RecSet = com.Execute
'Next
Set tfact = Nothing
td.Logout
td.Disconnect
td.ReleaseConnection
Set td = Nothing
End Sub