Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
1 reply Latest Post - ‏2013-03-07T21:15:06Z by GoodGulf
SystemAdmin
SystemAdmin
24948 Posts
ACCEPTED ANSWER

Pinned topic Unable to Connect ClearQuest to Excel

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

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.
Updated on 2013-03-07T21:15:06Z at 2013-03-07T21:15:06Z by GoodGulf
  • GoodGulf
    GoodGulf
    610 Posts
    ACCEPTED ANSWER

    Re: Unable to Connect ClearQuest to Excel

    ‏2013-03-07T21:15:06Z  in response to SystemAdmin
    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.