• 1 reply
  • Latest Post - ‏2013-03-07T21:15:06Z by GoodGulf
24948 Posts

Pinned topic Unable to Connect ClearQuest to Excel

‏2013-03-05T18:09:24Z |

I'm looking for a way to export defects into an Excel report (through a macro)

I;m unable to create a session that will connect the excel to CQ. This is what I have so far:

Dim strUsername As String
Dim strPassword As String
Dim strCQDB As String

strUsername = Trim(Sheet2.Cells(3, 3).Value)
strPassword = Trim(Sheet2.Cells(4, 3).Value)
strCQDB = Trim(Sheet2.Cells(5, 3).Value)

Dim cqsession As Session
'Set cqsession = New Session
Dim currentsession As String
Set currentsession = CreateObject("CLEARQUEST.SESSION")
Call currentsession.UserLogon(strUsername, strPassword, strCQDB, AD_SHARED_SESSION, "")

Dim dbDesc As Object
Set dbDesc = currentsession.GetSessionDatabase

Any help on this would be greatly appreciated!!! Thanks.
  • GoodGulf
    610 Posts

    Re: Unable to Connect ClearQuest to Excel

    You are declaring your session as a string and not a Session object.

    I don't know what version of Excel you're using but in the place where you're developing...
    Add ClearQuestOleServer as a reference (Tools->References).
    Scroll down and click the ClearQuestOleServer reference.

    All the CQ objects (you can view them with the Object Browser) will be now available to you.

    You can then declare your session as...
    Public Const AD_PRIVATE_SESSION = 2   Dim currentsession As Session Set currentsession = New Session currentsession.UserLogon(strUsername, strPassword, strCQDB, AD_PRIVATE_SESSION, 

    Instead of declaring your constants as I did above...
    You can import the clearquest.bas file from \program files\rational\clearquest into your workbook.
    This will set up all the Public "AD_xxx" constants you need.