Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Global session

I have a global variable declared as "Public cqSession As Session" On the
worksheet I have a button which when clicked connects to Rational Clearquest
and executes a query. within the button it connects using :
Set cqSession = CreateObject("CLEARQUEST.SESSION")
cqSession.UserLogon UserName, PassName, "CSR", AD_PRIVATE_SESSION, "CSR_Live"

This connection/logon takes a long time to process each time the button is
pressed.
Is there anyway I can do the connect/logon the first time the button is
pressed and leave the connection open until the spreadsheet is closed?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Global session

Declare another gloabl variable:

Global blnConnected as Boolean

Somewhere in the beginning of the vba code in the button (macro)


If blnConnected = false then
'Make connection
blnConnected = True
end if
'Run query here



jmonty


"Alvin" wrote:

I have a global variable declared as "Public cqSession As Session" On the
worksheet I have a button which when clicked connects to Rational Clearquest
and executes a query. within the button it connects using :
Set cqSession = CreateObject("CLEARQUEST.SESSION")
cqSession.UserLogon UserName, PassName, "CSR", AD_PRIVATE_SESSION, "CSR_Live"

This connection/logon takes a long time to process each time the button is
pressed.
Is there anyway I can do the connect/logon the first time the button is
pressed and leave the connection open until the spreadsheet is closed?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Global session

Thanks jmonty. I'e tried that as you suggested but it did not work. Every
time I click the button the session object has to be set and logon run and
the Boolean is empty.

The code I have is :
In the Workbook general declarations.

Public blnConnected As Boolean
Public cqSession As Session

In the Button

Dim queryDef As OAdQuerydef
Dim resultSet As OAdResultset
Dim entity As OAdEntity
Set curCell = Worksheets("Linked").Cells(1, 2)
UserName = curCell.Value
Set curCell = Worksheets("Linked").Cells(1, 4)
PassName = curCell.Value
If UserName = "" Or PassName = "" Then
If UserName = "" Then
MsgBox "Please enter your User ID."
Else
MsgBox "Please enter your Password"
End If
Else
Set curCell = Worksheets("Linked").Cells(2, 2)
cqid = curCell.Value
If cqid = "" Then
MsgBox "Please enter a defect ID"
Else
If blnConnected = False Then
Set cqSession = CreateObject("CLEARQUEST.SESSION")
cqSession.UserLogon UserName, PassName, "CSR", AD_PRIVATE_SESSION,
"CSR_Live"
blnConnected = True
End If

Set curCell = Worksheets("Linked").Cells(2, 3)
curCell.Value = ""
Worksheets("Linked").Range("A4:G500").Clear
Set curCell = Worksheets("Linked").Cells(2, 2)
CREATE SQL
sqlString = ??????????
Set resultSetObj = cqSession.BuildSQLQuery(sqlString)
resultSetObj.EnableRecordCount
resultSetObj.Execute

Count = resultSetObj.RecordCount
If Count 0 Then
For RowCount = 1 To Count
fetchStatus = resultSetObj.MoveNext
For Countfield = 2 To 8
colvalue = resultSetObj.GetColumnValue(Countfield)
Set curCell = Worksheets("Linked").Cells(RowCount + 3,
Countfield - 1)
curCell.Value = colvalue

Next
Next
Else
Set curCell = Worksheets("Linked").Cells(2, 3)
curCell.Value = "No Links Found"
End If
End If
End If

"jmonty" wrote:

Declare another gloabl variable:

Global blnConnected as Boolean

Somewhere in the beginning of the vba code in the button (macro)


If blnConnected = false then
'Make connection
blnConnected = True
end if
'Run query here



jmonty


"Alvin" wrote:

I have a global variable declared as "Public cqSession As Session" On the
worksheet I have a button which when clicked connects to Rational Clearquest
and executes a query. within the button it connects using :
Set cqSession = CreateObject("CLEARQUEST.SESSION")
cqSession.UserLogon UserName, PassName, "CSR", AD_PRIVATE_SESSION, "CSR_Live"

This connection/logon takes a long time to process each time the button is
pressed.
Is there anyway I can do the connect/logon the first time the button is
pressed and leave the connection open until the spreadsheet is closed?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to run RDP session alistew Excel Discussion (Misc queries) 0 February 22nd 08 11:27 AM
Startup and template locations in Citrix TS session and local session John Nurick Setting up and Configuration of Excel 2 September 21st 06 10:42 PM
Ending session Freddie Mac Excel Programming 11 June 30th 06 01:04 PM
Start a new session when a session is already opend MD Excel Programming 1 December 17th 05 05:47 PM
New Workbook New Session RWThomas Excel Programming 0 January 7th 04 05:56 PM


All times are GMT +1. The time now is 08:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"