Thread: Global session
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
jmonty jmonty is offline
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?