Simple connect and disconnect

 Dim tdc As TDConnection
 Set tdc = New TDConnection
 
 'Connect to server
 tdc.InitConnectionEx "http://myALMServer:8080/qcbin"
 
 'Authenticate user
 tdc.Login "fitzwilliam", "darcy"
 
 ' Connect to project
 tdc.Connect "austen_domain", "pemberley_project"
 
 ' Your code here
 '...
 
' Disconnect from the project. 
 tdc.Disconnect
 
 ' Log the user off the server
 tdc.Logout
 
 'Release the TDConnection object.
 tdc.ReleaseConnection
 
 ' Release the object
 Set tdc = Nothing